[英]Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.
At line:4 char:6
+ $r = Invoke-WebRequest -Uri $url
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
my client is facing this issue while other application trying to hit my service.我的客户正面临这个问题,而其他应用程序试图访问我的服务。 i enabled TLS 1.1.我启用了 TLS 1.1。 and 1.2 on my server和 1.2 在我的服务器上
If the client is attempting to negotiate the request using TLS 1.0, but only TLS 1.1 and 1.2 are supported you will get this error.如果客户端尝试使用 TLS 1.0 协商请求,但仅支持 TLS 1.1 和 1.2,您将收到此错误。
Try forcing the client to utilize TLS 1.2 by adding the below code to the client's application before the request is made to your service.在向您的服务发出请求之前,尝试通过将以下代码添加到客户端的应用程序来强制客户端使用 TLS 1.2。
PowerShell:电源外壳:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
C#: C#:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
See:看:
Update .NET web service to use TLS 1.2 更新 .NET Web 服务以使用 TLS 1.2
Powershell Setting Security Protocol to Tls 1.2 Powershell 将安全协议设置为 TLS 1.2
The cause of the error is Powershell by default uses TLS 1.0 to connect to website, but website security requires TLS 1.2.错误原因是Powershell默认使用TLS 1.0连接网站,但网站安全需要TLS 1.2。 You can change this behavior with running any of the below command to use all protocols.您可以通过运行以下任何命令来更改此行为以使用所有协议。 You can also specify single protocol.您还可以指定单个协议。
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Ssl3
[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3"
U mean to say i should ask third party to add below code to their application before calling our service???你的意思是说我应该要求第三方在调用我们的服务之前将以下代码添加到他们的应用程序中???
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
that means the issue is on their site??这意味着问题出在他们的网站上?? because i have enabled all TLS version on our server.因为我在我们的服务器上启用了所有 TLS 版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.