我有一个在.NET Framework 4.7中开发的asp.net mvc网站。从托管网站获取连接问题。你能帮忙吗
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
答案 0 :(得分:1)
我通常在调试时遇到此错误,但是如果部署此错误,它将消失。
为了进行调试,请在调用外部服务之前添加以下行。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;