【指定ssl协议版本】远程主机强制关闭了现有连接 existing connection was forcibly closed by the remote host

Stack Trace:

...

System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)

...

 

发起请求之前,指定ssl协议版本

//.NET 4.5 默认 TLS 1.0 ,兼容其它或者更高版本
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls | System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;

posted @ 2022-04-29 10:05  毛毛虫!  阅读(368)  评论(0编辑  收藏  举报