powershell-Invoke-WebRequest请求https出现-请求被中止: 未能创建SSL/TLS安全通道解决办法
出现“请求被中止: 未能创建 SSL/TLS 安全通道。”的问题。
在创建请求地址的前面加了这句代码就可以了
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
代码示例:
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(serverURL); req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; strNewValue = "cmd=_notify-synch&tx=" + System.Web.HttpContext.Current.Request.QueryString["tx"] + "&at=" + PayPalParameter.BusinessToken;
powershell 使用Invoke-WebRequest https://example 出现“请求被中止: 未能创建 SSL/TLS 安全通道。”的解决办法
[System.Net.ServicePointManager]::SecurityProtocol=[System.Net.SecurityProtocolType]::Tls12
Invoke-WebRequest https://