Search code examples
c#sslhttpwebrequestssl-certificate

HttpWebRequest: Could not establish Trust Relationship for SSL - Self Signed Certificate already added to Trusted Root CA


"Exception thrown: 'System.Net.WebException' in System.dll

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

I have added/imported my self-signed certificate to Trusted RootCA for my local machine and for my current user, and I am still getting the above exception.

Any ideas as to why my .net still won't accept my certificate?


Solution

  • I resolved this issue by changing the URL of the site I was trying to access the web service on.

    By choosing a URL with the computer name (rather than local host), it accepted the certificate.