用 C# 访问有SSL的Web Service

 
    在程序的第一次启动,加入 下面这个代码。就可以访问 SSL了。
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;

否则就会报下面的错误。

Failed to load broad.The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

不过我测试服务器的证书是假的。加了上面那句代码可能有安全隐患。
原文地址:https://www.cnblogs.com/fantasylu/p/1813391.html