September 23, 2013 Leave a comment
If you see the following message when trying to call a secure web service from .NET applications, it normally is associated with the SSL certificate being expired or not valid for the URL you ‘re calling:
[System.Net.WebException]: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. Inner error [System.Security.Authentication.AuthenticationException]: The remote certificate is invalid according to the validation procedure.
Make sure you really investigate if the certificate is valid.
In a recent case we had to deal with the reason the certificate was throwing this error was the root certificate authority has been changed when the third party service renewed their SSL certificate. The new certificate authority Go Daddy was not recognized by the web server (old Windows 2003 server) and then the server considered the certificate invalid.
It took us awhile to figure it out, but after registering the certificate authority on the server it worked fine.