[英]C# Windows Service ,The request was aborted: Could not create SSL/TLS secure channel with SecurityProtocol
[英]The request was aborted: Could not create SSL/TLS secure channel - SecurityProtocol behavior
将证书安装到Trusted Root Certification Authorities
的Local Computer
存储中后,.NET WebRequest
仍然会抛出:
The request was aborted: Could not create SSL/TLS secure channel
ServicePointManager.SecurityProtocol
现在包含SecurityProtocolType.Ssl3
| SecurityProtocolType.Tls
。
阅读SimonDugré的回答https://stackoverflow.com/a/2904963/121968后 ,我设置了:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
它工作正常。 回头后:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
它仍然可以正常工作 。 我有两个问题:
为什么它仍然有效? 有没有缓存?
为什么它之前只使用标志Ssl3
而不是Ssl3
和Tls
?
有SSL / TLS会话恢复,可能是你的情况。 也许你没有共享的TLS1密码套件。 检查的最佳方法是运行Wireshark,并查看连接的SSL数据包,它们在Wireshark中有很好的解释。
我的解决方案是添加以下行:
ServicePointManager.Expect100Continue = True
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 Or SecurityProtocolType.Tls
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.