写在前面

在模拟请求的时候,如果url为https的,会报这个错误。大概错误就是:基础连接已关闭:无法建立信任关系的SSL / TLS的安全通道。

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

基础连接已关闭:无法建立信任关系的SSL / TLS的安全通道。

解决办法

在模拟请求的方法中加上这样一句话。

 ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback((obj, certificate, chain, sslPolicyErrors) =>
                {
                    return true;
                });

 参考:http://robertgreiner.com/2013/03/could-not-establish-trust-relationship-for-the-ssl-tls-secure-channel/

相关文章:

  • 2022-12-23
  • 2021-11-28
  • 2021-07-09
  • 2022-12-23
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2021-10-23
  • 2022-12-23
  • 2021-12-16
  • 2022-02-23
  • 2021-12-19
  • 2021-06-11
  • 2021-09-10
相关资源
相似解决方案