![](/img/trans.png)
[英]WCF - 'The service certificate is not provided for target' error for WCF client calling a WCF service
[英]Certificate error when calling WCF service from Windows Service
我在IIS7上托管了WCF服务。 从Silverlight客户端和C#Windows服务均可调用此服务。 目前,所有内容都在同一台计算机上运行。 它使用具有授权.cer文件的自签名证书,我使用certmgr.msc将其导入到受信任的根目录中
Silverlight应用程序可以很好地调用该服务,但是当Windows Service尝试调用该服务时,出现以下异常:
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.
当浏览器和Silverlight应用程序可以通过https访问该服务时,拒绝Windows服务的原因是什么? 可能是因为客户端证书指纹必须与Windows服务绑定吗?
(如您所见,我对SSL身份验证的工作还是很陌生的)。
谢谢
我发现了问题。 原来,我仅将CA导入到当前的用户存储中,而不是将其导入到本地计算机存储中,因此Windows服务找不到它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.