要求已經中止: 無法建立 SSL/TLS 的安全通道?

當程式執行HttpWebRequest時,會出現錯誤訊息
要求已經中止: 無法建立 SSL/TLS 的安全通道
解決方法如下
建立連線前,加入以下程式
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
沒有留言:
張貼留言