The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
When I try to connect to a remote WCF service which uses basicHttpBinding and transport security, I got this error message.
It turns out that the reason of the error is the root certificate that issues the certificate for the WCF site is not in the calling machines "Trusted Root Certification Authority" store.
By obtaining the root public certificate and import it into calling machines "Trusted Root Certification Authority" store, the problem solved.
It is easy to obtain root public certificate using just the browser. Take Chrome as an example:
It turns out that the reason of the error is the root certificate that issues the certificate for the WCF site is not in the calling machines "Trusted Root Certification Authority" store.
By obtaining the root public certificate and import it into calling machines "Trusted Root Certification Authority" store, the problem solved.
It is easy to obtain root public certificate using just the browser. Take Chrome as an example:
- Open Chrome and type the secured URL into the address bar, for example, https://www.google.ca/
- In the browser address bar, click the lock icon in front the address. In the pop-up window, click the "Details" link after the sentence "Your connection to this site is private"
- Click the "View Certificate" button on the right panel
- In the "Certificate" dialog window, click "Certification Path" tab and then double-click the root certificate node.
- Another "Certificate" dialog window is open. Click the "Details" tab and then click the "Copy to File" button.
- The "Certificate Export Wizard" dialog will open. Follow the screen instruction to export the certificate to file.
- Import the saved certificate into "Trusted Root Certification Authority" store of the calling machine.
Comments