WCF – Could not able to establish trust relationship

Recently we faced this issue with one of our WCF Rest service. This service is working fine with http and we converted the same to use https using server certificate. Server certificate is added to the Trusted Root certificates store in both server and in client.

Client uses the following code, where it creates a HttpWebRequest and add the certificate to the request. 

 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(strURL + “/” + MethodName);
//Add Certificate to the HTTPWebRequest

 WebResponse response = webRequest.GetResponse();

But when the GetResponse executes, it throws the excepttion “Could not able to establish trust relationship”. We are able to browse  service from Client side browser.


Client is accessing the WCF service using IP address (eg:- of the server[eg:-] and the certificate issued to[Verify the Issued to attribute of the certifiate] the name of the system(eg:- testServer.domain.com). Once we changed the WCF service URL with server name[eg:- https://testServer.domain.com/TestService/service] it starts working.

About ambilykk

I am a Technology Evangelist on Microsoft Technologies. I am carrying the passion on Microsoft technologies specifically on web technologies such as ASP .Net and Ajax. My interests also include Azure and Visual Studio. Technology adoption and learning is my key strength and technology sharing is my passion.
This entry was posted in WCF and tagged , , . Bookmark the permalink.

4 Responses to WCF – Could not able to establish trust relationship

  1. Dina says:

    this is a great inspiring article. i am pretty much pleased with your good work. you put really very helpful information

  2. Caroline says:

    really cool website. i loved it

  3. Emanuele says:

    great read.

  4. gold account says:

    I tried to access the service from a different machine by giving the IP of the server ie where the wcf service is running. But the service is not accessible. Any help?

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 )

Connecting to %s