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
webRequest.ClientCertificates.Add(Cert);
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.
Solution
Client is accessing the WCF service using IP address (eg:- 134.25.122.45) of the server[eg:- https://134.25.122.45/TestService/service] 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.
this is a great inspiring article. i am pretty much pleased with your good work. you put really very helpful information
really cool website. i loved it
great read.
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?