問題:當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