2013-07-11 135 views
0

我有IIS7上托管的WCF服务。此服务既是从Silverlight客户端,也是从C#Windows服务中调用的。目前一切运行在同一台机器上。 它使用一个自签名证书,并使用certmgr.msc将其导入到受信任根中的一个自签名证书。从Windows服务调用WCF服务时出现证书错误

Silverlight应用程序可以调用该服务,但是当Windows服务尝试调用该服务时,我得到以下异常:

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.  

什么是Windows服务将被拒绝访问,同时在浏览器和Silverlight应用程序可以访问通过https服务的原因是什么? 是否可能是因为客户端证书指纹必须与Windows服务绑定?

(我对SSL验证的工作很陌生,如你所见)。

谢谢

+0

如果您想忽略SSL,此答案显示另一个解决方案; http://stackoverflow.com/questions/109186/bypass-invalid-ssl-certificate-errors-when-calling-web-services-in-net – arame3333

回答

0

我发现了这个问题。 原来我只将CA导入当前的用户存储而不是本地计算机存储,所以Windows服务找不到它。

相关问题