System.Net.WebException: 请求被中止: 未能创建 SSL/TLS 安全通道。
客户端执行https请求时,报出“System.Net.WebException: 请求被中止: 未能创建 SSL/TLS 安全通道。”的问题。原因是:服务端更改了安全协议,而执行的客户端并未注册该协议。
如果客户端的.net framework版本低于4.0,协议类型枚举中只有
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
需修改成如下任一方式即可(系统需支持.net framework4.5及以上版本):
1、ServicePointManager.SecurityProtocol = (SecurityProtocolType)48
| (SecurityProtocolType)192
| (SecurityProtocolType)768
| (SecurityProtocolType)3072;
or
2、ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
| SecurityProtocolType.Tls
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls12;文章来源地址https://www.toymoban.com/news/detail-439613.html
文章来源:https://www.toymoban.com/news/detail-439613.html
到了这里,关于System.Net.WebException: 请求被中止: 未能创建 SSL/TLS 安全通道。的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!