C# 请求被中止: 未能创建 SSL/TLS 安全通道”的原因及解决办法
代码前加上如下代码:
ServicePointManager.Expect100Continue =true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
ServicePointManager.ServerCertificateValidationCallback =(sender, certificate, chain, errors)=>true;
或者
ServicePointManager.SecurityProtocol =(SecurityProtocolType)192|(SecurityProtocolType)768|(SecurityProtocolType)3072;
或者
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
| SecurityProtocolType.Tls
|(SecurityProtocolType)0x300//Tls11|(SecurityProtocolType)0xC00;//Tls12
本文转载自: https://blog.csdn.net/fwj380891124/article/details/124845974
版权归原作者 星火燎猿 所有, 如有侵权,请联系我们删除。
版权归原作者 星火燎猿 所有, 如有侵权,请联系我们删除。