【问题标题】:windows server 2012 R2 : could not establish secure channel for ssl/tls [duplicate]Windows Server 2012 R2:无法为 ssl/tls 建立安全通道 [重复]
【发布时间】:2021-07-15 15:18:45
【问题描述】:

我无法通过 c# 发送 https 请求我尝试使用我找到的所有答案,但我遇到了同样的错误 (无法为 ssl/tls 建立安全通道) 我添加了这行代码,并没有解决问题

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Ssl3|SecurityProtocolType.Tls;

但是当我使用 Windows 10 时请求正常工作,但在 Windows 7 中无法正常工作,尽管如果我通过 Fiddler 或 Postman 发送请求,它在 Windows 7 中工作

【问题讨论】:

标签: c# .net http https httpwebrequest


【解决方案1】:

试试这个

if (ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12) == false)
{
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
}

【讨论】:

  • 我遇到了同样的错误
猜你喜欢
  • 1970-01-01
  • 2020-05-15
  • 2017-08-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-05
  • 2011-04-28
  • 2023-03-14
相关资源
最近更新 更多