#region private static bool ValidateServerCertificate 解決Error"基礎鏈接已經關閉: 未能爲SSL/TLS 安全通道創建信任關係。" /// <summary> /// 解決Error"基礎鏈接已經關閉: 未能爲SSL/TLS 安全通道創建信任關係。" /// </summary> /// <param name="sender"></param> /// <param name="certificate"></param> /// <param name="chain"></param> /// <param name="sslPolicyErrors"></param> /// <returns></returns> private static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; } #endregion .............................. .............................. ............................. ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; byte[] responseArray = webClient.UploadValues(url, postValues);
在請求以前加上web
ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;