版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_23502409/article/details/86610211
在使用HttpWebRequest请求API的时候总是报错,后来发现是需要设置传输协议。
在代码里面创建Request之前添加如下代码即可:
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;