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://


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM