0

I have a WCF service hosted on IIS7. This service is called both from a Silverlight client and from a C# Windows service. At the moment everything is running on the same machine. It uses a self-signed certificate, with an authority .cer file which I imported into the trusted root using certmgr.msc

The Silverlight app can call the service just fine, but when the Windows Service tries to call it, I get the following exception:

System.ServiceModel.Security.SecurityNegotiationException: Could not establish trust 
relationship for the SSL/TLS secure channel with authority 'localhost'. ---> 
System.Net.WebException: The underlying connection was closed: Could not establish 
trust relationship for the SSL/TLS secure channel. ---> 
System.Security.Authentication.AuthenticationException: The remote certificate is 
invalid according to the validation procedure.    

What are the reasons that the Windows service would be denied access while the browser and Silverlight app can access the service over https? Is it maybe because the client certificates thumbprint must be tied to the windows service or something?

(I'm kind of new to the workings of SSL authentication as you can see).

Thanks

plsch
  • 125
  • 7
  • This answer shows another solution if you want to ignore SSL; http://stackoverflow.com/questions/109186/bypass-invalid-ssl-certificate-errors-when-calling-web-services-in-net – arame3333 Jan 23 '15 at 09:44

1 Answers1

0

I found the problem. Turns out I had only imported the CA into the current user store and not the Local Computer store, so the Windows service couldn't find it.

plsch
  • 125
  • 7