运行invoke-webrequest报错:

  Invoke-WebRequest : 请求被中止: 未能创建 SSL/TLS 安全通道。

  根据你的 PowerShell、.NET Framework 的版本和升级,WEB 连接的缺省安全协议可能仍然是 SSL3。

您可以方便地查明它:

  Invoke-WebRequest : 请求被中止: 未能创建 SSL/TLS 安全通道。

[Net.ServicePointManager]::SecurityProtocol

  返回的协议不包含 Tls12,那么可能无法用 PowerShell 连接到安全的 Web Service 和网站。

我们只需要这样操作就可以启用更多的服务:

  Invoke-WebRequest : 请求被中止: 未能创建 SSL/TLS 安全通道。

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3 -bor [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
[Net.ServicePointManager]::SecurityProtocol

至此问题已经完全解决

  Invoke-WebRequest : 请求被中止: 未能创建 SSL/TLS 安全通道。

 

相关文章:

  • 2022-12-23
  • 2021-01-20
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-07
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案