Could Not Establish Trust Relationship For The SSL/TLS Secure Channel

The underlying connection was closed. Could not establish trust relationship for the SSL/TLS secure channel.

In this article we will be seeing how to resolve the following issue "The underlying connection was closed. Could not establish trust relationship for the SSL/TLS secure channel".

Problem

I was trying to create Visual Web Part in SharePoint 2010 using Visual Studio 2010 in which I need to access the HTTPS listdata.svc web service. When I was trying to access the https web service I was getting the following error



Error Message

"The underlying connection was closed. Could not establish trust relationship for the SSL/TLS secure channel".

How to resolve

Since we are trying to access the HTTPS web service we need to add the SSL to the SharePoint Trusted Root Authority.

Export an SSL certificate from windows server

Steps Involved

  • Go to Start => Run => Type MMC and then click on Ok.


  • In Microsoft Management Console, Click on the File menu and then click on Add\Remove Snap-in...


  • In the Add or Remove Snap-ins wizard, select Certificates from the available snap-ins and then click on Add.


  • Select My user account and click on Finish.


  • Certificate will be added and click on Ok.


  • In the left pane expand Certificates, and then expand Personal.

  • Click on Certificates folder.Right click on the certificate, click on All Tasks and then click on Export.