C# 请求已中止:无法创建SSL/TLS安全通道-SecurityProtocol行为

C# 请求已中止:无法创建SSL/TLS安全通道-SecurityProtocol行为,c#,.net,ssl-certificate,ssl,C#,.net,Ssl Certificate,Ssl,将证书安装到本地计算机受信任的根证书颁发机构的存储后,.NETWebRequest仍会抛出: The request was aborted: Could not create SSL/TLS secure channel ServicePointManager.SecurityProtocol现在包含SecurityProtocolType.Ssl3|SecurityProtocolType.Tls 在阅读Simon Dugré的回答后,我设置了: ServicePointManager.S

将证书安装到
本地计算机
受信任的根证书颁发机构的存储后,.NET
WebRequest
仍会抛出:

The request was aborted: Could not create SSL/TLS secure channel
ServicePointManager.SecurityProtocol
现在包含
SecurityProtocolType.Ssl3
|
SecurityProtocolType.Tls

在阅读Simon Dugré的回答后,我设置了:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
它工作正常。 后退后:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
它仍然可以正常工作。我有两个问题:

  • 为什么它仍然有效?是否存在某种缓存

  • 为什么它以前只使用flag
    Ssl3
    而不使用 同时使用
    Ssl3
    Tls


  • 有SSL/TLS会话恢复,可能就是您的情况。 可能您没有共享的TLS1密码套件。
    最好的检查方法是运行Wireshark,并查看连接的SSL数据包,Wireshark对这些数据包进行了很好的解释。

    我的解决方案是添加以下线路:

     ServicePointManager.Expect100Continue = True
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 Or SecurityProtocolType.Tls