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

web services

I have a web service which calls make a soap request. While debugging in VS.NET 2008 the soap request is successful. However when I deploy it, I get the following error

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

This must be some sort of security setting I need to change, but I don't know what?

I have tried to deploy the code with:

System.Security.Cryptography.X509Certificates.X509Certificate cert = null;
cert = new System.Security.Cryptography.X509Certificates.X509Certificate();
cert.Import("c:\customerCertFile.cer");
objRequest.ClientCertificates.Add(cert);

//WebProxy iBproxy = new WebProxy("196.2.124.252",true);
WebProxy iBproxy = new WebProxy("192.1.1.1", true);
iBproxy.Credentials = new NetworkCredential("username", "password");
objRequest.Proxy = iBproxy;

No luck.

Thanks in advance!

Best Answer

If you are attempting to use SSL with your local IIS server you'll need to configure it with a self signed certificate using makecert or a similar tool.

Related Topic