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:- 18.104.22.168) of the server[eg:- https://22.214.171.124/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.