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.
View Comments (3)
Thanks! I got same error and it resolved it sharply. Thanks a lot!
Cool comment, however, "My application is using .NET Framework 4.6.2. Sufficient explanations abour security protocols are available at Perficient blog post "has a spelling error
Note that there is a known vulnerability since 2014 with SSL 3.0 and that Microsoft recommends not using it anymore... https://docs.microsoft.com/en-us/security-updates/securityadvisories/2015/3009008