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