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;
网络安全工程师(白帽子)企业级学习路线
第一阶段:安全基础(入门)
第二阶段:Web渗透(初级网安工程师)
第三阶段:进阶部分(中级网络安全工程师)
如果你对网络安全入门感兴趣,那么你需要的话可以点击这里👉网络安全重磅福利:入门&进阶全套282G学习资源包免费分享!
学习资源分享
![](https://img-blog.csdnimg.cn/img_convert/d694d3c4c008a8dae01e0ac8b05193f9.jpeg)