0

I have a asp.net mvc website developed in .NET framework 4.7. getting connection issue from hosted website. can you please help

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: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

1 Answers1

2

I usually face this error while debugging, but if you deploy this it will disappear.
For debugging purpose, add following lines before calling external services.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

Manish
  • 1,139
  • 7
  • 21