摘自:https://blog.csdn.net/lan_liang/article/details/70948221
在进行HTTPS连接时,需要指定SecurityProtocol。对于.NET 4.0的代码,需要强制转换。
...
System.Net.ServicePointManager.SecurityProtocol = (SecurityProtocolType) 192 |
(SecurityProtocolType) 768 |
(SecurityProtocolType) 3072;
...
在 .net 4.5以上的代码使用以下代码即可。
System.Net.ServicePointManager.SecurityProtocol =
System.Net.SecurityProtocolType.Ssl3
| System.Net.SecurityProtocolType.Tls12
| SecurityProtocolType.Tls11
| SecurityProtocolType.Tls;