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

运行invoke-webrequest报错:

  

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

您可以方便地查明它:

  

[Net.ServicePointManager]::SecurityProtocol

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

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

  

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

至此问题已经完全解决

  

猜你喜欢

转载自www.cnblogs.com/feiyucha/p/11073931.html