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

后端 未结 1 868
执笔经年
执笔经年 2021-01-21 06:41

I am developing a Metro style app using C# and xaml.

In my application I got the error when calling to a web service:

The underlying connection wa

相关标签:
1条回答
  • 2021-01-21 07:19

    I have a crawler program and a few moments ago I got the same exception. The reason in my case is that the security certificate (of the site I have been crawling) expired.

    A quick fix in my case was adding this line of code:

     ServicePointManager.ServerCertificateValidationCallback = new
    RemoteCertificateValidationCallback
    (
       delegate { return true; }
    );
    

    Note: this hack could be a security threat

    0 讨论(0)
提交回复
热议问题