问题:当https 协议只支持 TLS 1.2 版本以上协议的时候。常规的 get post 请求将会失败:
报错信息:请求被中止: 未能创建 SSL/TLS 安全通道 4.0
解决方案:
在发送HTTP请求前加入下行代码
ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;
如果是4.5以上版本可以直接使用
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
TLS 协议解释:https://blog.csdn.net/mrpre/article/details/77978293