When calling Third Party API getting error Authentication failed because the remote party has closed the transport stream.

Sourabh Salve 1 Reputation point
2022-03-04T18:19:28.433+00:00
  1. I have upgraded our aws ec2 instance Windows 2012 r2 to Windows 2016 to support TLS 1.2 ciphers and also enable only TLS1.2 protocol using registry but still I am facing same error.
  2. Also I have added "SystemDefaultTlsVersions" = dword:00000001 and "SchUseStrongCrypto" = dword:00000001 in respective registry.
  3. On "https://www.ssllabs.com/ssltest/ " also it showing A+ grade.
  4. It is not possible for us to change in code and redeploy it on production server.
  5. In web.config file httpruntime and compilation targetFramework is 4.5
  6. Also I had added below code in "ApplicationHost.config" file, <configuration>
    <runtime>
    <AppContextSwitchOverrides value="Switch.System.Net.DontEnableSystemDefaultTlsVersions=false"/>
    </runtime>
    </configuration>. But because of this, IIS was stopped working and was not able to start. so I revert this change.

I am trying to solve this error from January End and tried all possibilities but not able to solve this error.

"System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream. at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)"

Please help me on this issue.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,273 questions
{count} votes