Could not establish trust relationship for the SSL/TLS secure channel with authority
A frustrating issue I run into occasionally in calling web services on my Windows development machine is “Could not establish trust relationship for the SSL/TLS secure channel with authority”. I usually have to think back and search on the internet how to fix it.
Certificates can be a little confusing and I’m one who just wants to do as little work as possible to get past irrelevant issues so I can get to what is important. I know enough about certificates to use them and deploy them but I’m not an expert. So what I have found works but there may be better solutions.
Anyway, here are a couple of ways I’ve resolved the issue.
First, if you just want to ignore all certificates and you don’t mind a hard-coded solution, you can add this code to the client before calling the service: System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
A second option is that you can use the manage certificates snap-in. Navigate to the Personal\Certificates folder and copy the localhost certificate to the Trusted Root Certification Authorities\Certificates folder.