出現“請求被中止: 未能創建 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://