Authentication failed because the remote party has closed the transport stream

One beautiful day I found the following exception from application error logs: “Authentication failed because the remote party has closed the transport stream exception” and one of our integrations was down. The problem occured only in ASP.NET MVC application. Background services using same external service were not affected. Here’s the solution.

We had to enable more security protocols in web application. Add the following line somewhere in your ASP.NET MVC application.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

My application is using .NET Framework 4.6.2. Sufficient explanations abour security protocols are available at Perficient blog post TLS 1.2 and .NET Support: How to Avoid Connection Errors.

Liked this post? Empower your friends by sharing it!

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    One thought on “Authentication failed because the remote party has closed the transport stream

    • June 12, 2019 at 7:05 am
      Permalink

      Thanks! I got same error and it resolved it sharply. Thanks a lot!

    Leave a Reply

    Your email address will not be published. Required fields are marked *