Wcf服务抛出异常:无法建立具有权限的SSL/TLS安全通道的信任关系
我知道关于堆栈溢出有很多问题,但没有一个是最近的,似乎没有解决我的问题最充分。Wcf服务抛出异常:无法建立具有权限的SSL/TLS安全通道的信任关系
情况如下:
我们有一个在IIS 6.2上运行的web服务。 web服务被配置为只接受https流量。网站上的绑定配置为在默认端口443上的所有可用IP地址上使用HTTPS。所选ssl证书是购买的专用证书。
该网站是一个专门的应用程序池中运行,用专用的用户
证书链安装在Web服务器,本地机器下在以下位置:
- 根CA - 可信根证书颁发机构
- 组织验证CA - 中间证书颁发机构
- PFX证书 - 个人
在pfx证书中,我授予'管理私钥'选项中的专用用户读权限。在调试时我还授予以下帐户的读取权限:
- network服务
- IUSR
- iis_iusr
我已经添加了诊断的WebService创建svclog并启用日志记录IIS上的web服务实例。这两个日志似乎都没有任何信息。
在解决问题时,我尝试运行本地测试客户端。为此,我需要在当前用户的个人存储中安装* .cer文件。
请注意,我们在网络服务器上试过这个,但也在本地机器上试过。这两个结果在以下错误消息:
无法建立信任关系与权力my.domain.com
客户端的配置的SSL/TLS安全通道:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpsBinding>
<binding name="*MyServiceBinding*" sendTimeout="00:05:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" >
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</basicHttpsBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="endpointBehavior">
<clientCredentials >
<clientCertificate findValue="my.domain.com" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="https://my.domain.com/myService.svc"
behaviorConfiguration="endpointBehavior" binding="basicHttpsBinding"
bindingConfiguration="myServiceBinding" contract="MyService.IMyService"
name="MyServiceEndpoint">
<identity>
<certificateReference findValue="my.domain.com" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" isChainIncluded="false" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
web服务的配置,我只提取相关部分(据我所知):
<bindings>
<basicHttpsBinding>
<binding name="basicHttpsEndpointBinding">
<security mode="Transport">
<transport clientCredentialType="Certificate"/>
</security>
</binding>
</basicHttpsBinding>
</bindings>
<serviceBehaviors>
<behavior name="httpsBehaviour">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false" httpsGetBindingConfiguration="basicHttpsEndpointBinding" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<serviceCertificate findValue="my.domain.com" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
<service behaviorConfiguration="httpsBehaviour" name="My.Service.MyService">
<endpoint binding="basicHttpsBinding" bindingConfiguration="basicHttpsEndpointBinding" name="MyServiceEndpoint" contract="My.Service.MyService.Interfaces.IMyInterFace">
<identity>
<certificateReference findValue="my.domain.com" isChainIncluded="false" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
</identity>
</endpoint>
</service>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
<baseAddressPrefixFilters>
<add prefix="https://my.domain.com/" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
如果需要额外的信息,那么我很高兴并愿意提供。如果有什么不清楚的地方,请提问,我会尽可能地澄清。
任何帮助,非常感谢!
编辑:格式,日志信息
最终我用下面的计算器问题解决了这个问题:
HTTP error 403.16 - client certificate trust issue
总之,微软已经在Windows Server 2012,这意味着更新其安全如果在受信任的根证书颁发机构店存在其中标的不等于任何证书,该服务将返回一个403.16 HTTP异常。
由IIS中C记录错误消息:\的Inetpub \日志\ LogFiles文件\ W3SV *。 '*'是IIS中您的网站的ID。
要知道,IIS的日志记录被添加到日志文件的时间间隔!
审查我来到翻过了403.16例外,来到上面的堆栈溢出问题的日志文件之后。
我删除了我们添加的所有证书,这些证书是自签名的,发行人和主题不匹配。这解决了这个问题。