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.

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s