切换TLS1.2后,C#请求报错:请求被中止: 未能创建 SSL/TLS 安全通道 发表评论 614 viewsA+所属分类:原创 工具&方法 开发&源码 最近因为安全性要求:将所有域名TLS版本限制为1.2才能访问,禁用了之前的1.0和1.1。但是在.net后台进行请求时报错“请求被中止: 未能创建 SSL/TLS 安全通道” 通过以下方式解决: ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; 1 ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; 具体原理参考微软官方文档:https://docs.microsoft.com/zh-cn/dotnet/api/system.net.servicepointmanager.securityprotocol?view=net-5.0 https://support.microsoft.com/zh-cn/topic/%E6%97%A0%E6%B3%95%E8%BF%9E%E6%8E%A5%E5%88%B0%E4%B8%80%E5%8F%B0%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%8D%87%E7%BA%A7%E5%88%B0-net-framework-4-6-%E5%90%8E%E4%BD%BF%E7%94%A8-servicepointmanager-%E6%88%96-sslstream-api-1e3a9788-ab0d-7794-204b-6c4678bc5ed5 我的微信公众号 微信扫一扫关注公众号,不定时更新 赞 1 赏 分享