The underlying connection was closed: An unexpected error occurred on a send. This problem usually happens when the computer is using the Proxy/VPN. Please disable the Proxy/VPN temporary and try again.
The underlying connection was closed: An unexpected error occurred on a receive. This problem occurs when the server or another network device unexpectedly closes an existing Transmission Control Protocol (TCP) connection.
For me it was tls12:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
If you are stuck with .Net 4.0 and the target site is using TLS 1.2, you need the following line instead.
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
source: TLS 1.2 and .NET Support: How to Avoid Connection Errors
The code below resolved the issue
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls Or SecurityProtocolType.Ssl3
Go to your web.config/App.config to verify which .net runtime you are using
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
Here is the solution:
.NET 4.6 and above. You don’t need to do any additional work to support TLS 1.2, it’s supported by default.
.NET 4.5. TLS 1.2 is supported, but it’s not a default protocol. You need to opt-in to use it. The following code will make TLS 1.2 default, make sure to execute it before making a connection to secured resource:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
In my case the site that I'm connecting to has upgraded to TLS 1.2. As a result I had to install .net 4.5.2 on my web server in order to support it.
I've been having the same issue for days now with an integration that also just "used to work before".
Out of sheer depression, I just tried
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
This solved it for me..even though the integration strictly only makes use of SSLv3.
I came to the realization that something if off since Fiddler reported saying that there is an "empty TLS negotiation cipher" or something of the like.
Hopefully it works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With