Calling a secure web service from within an ASP.NET application was generating the following exception:
The remote certificate is invalid according to the validation procedure.
Digging further down into the exception provided a little more detail:
Could not establish trust relationship for the SSL/TLS secure channel with authority 'companyaddress.com'
But, this still didn’t give me too many clues as to the problem. I then came across this very useful MSDN blog post that gave me some very valuable steps to follow to resolve the issue. My first problem was that there were a couple of intermediate certificates involved that needed to be installed to the relevant locations on the server where my ASP.NET app was running; but this didn’t solve the problem so I set up the tracing file and ran the request again. This time the error was a bit more helpful:
Certificate name mismatch
It turns out that my problem was the endpoint address in my web.config file did not match the address in the certificate. My endpoint address was entered as companyaddress.com but the certificate was issued to www.companyaddress.com. The final part of the solution was to change the endpoint address in the web.config to match that in the certificate.