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

后端 未结 5 2011
遇见更好的自我
遇见更好的自我 2021-02-05 05:35

I have a simple app that uses the C# Web Client class to download a websites HTML. This is a stripped down sample of the code I\'m using:

WebClient wc = new Web         


        
5条回答
  •  南方客
    南方客 (楼主)
    2021-02-05 06:07

    I had this issue with message:

    Could not establish trust relationship for the SSL/TLS secure channel.

    I was connecting to a web service on an Apache server using a .NET client. This is what corrected the problem for me.

    (proxy).UserAgent = "Apache-HttpClient/4.1.1 (java 1.5)";
    

提交回复
热议问题