0

I have WCF service hosted on local IIS with self signed certificate, which is used for testing and Windows service and Windows application that connects to that WCF service and send some data.

Both Windows application and Windows service uses same dll to connect to WCF service but windows service fails with:

System.ServiceModel.Security.SecurityNegotiationException: Could not establish trust relationship for the SSL/TLS secure channel with authority 'local-domain'. ---> 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.

Windows service account is set to LocalSystem, could this be possible reason for this? If so, under which account should I run windows service?

formatc
  • 4,261
  • 7
  • 43
  • 81
  • http://superuser.com/questions/370217/trust-ssl-certificate-to-local-system-account – Daniel Hilgarth Jan 21 '13 at 11:32
  • @Daniel I already done that. It's strange that it works from application and not from service. – formatc Jan 21 '13 at 11:39
  • Please look at the following link: http://stackoverflow.com/questions/109186/bypass-invalid-ssl-certificate-errors-when-calling-web-services-in-net – Dhawalk Jan 21 '13 at 16:37

1 Answers1

0

It could be because when running it as an Application you are using YOUR Windows credentials but when running under the service it is probably running as Local System. Try changing your Windows Service to run with your credentials and see if that works. If so you should create a user specifically for running the service so if you change your password you don't break the service.

Belogix
  • 8,129
  • 1
  • 27
  • 32