【发布时间】:2016-12-11 18:23:47
【问题描述】:
我知道有很多关于堆栈溢出的问题,但没有一个是最近出现的,似乎没有完全解决我的问题。
情况如下:
我们有一个在 IIS 6.2 上运行的 web 服务。 Web 服务配置为仅接受 https 流量。网站上的绑定配置为在所有可用的 IP 地址上使用 HTTPS,在默认端口 443 上。选择的 ssl 证书是购买的专用证书。
该网站在一个专用的应用程序池中运行,有一个专用的用户
证书链安装在网络服务器上,位于以下位置的本地计算机下:
- Root ca - 受信任的根证书颁发机构
- 组织验证 ca - 中级认证机构
- pfx 证书 - 个人
在 pfx 证书中,我在“管理私钥”选项中授予了专用用户读取权限。在调试时,我还授予以下帐户读取权限:
- 网络服务
- 你自己
- iis_iusr
我已向 Web 服务添加了诊断程序以创建 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>
webservice的配置,我只提取了相关部分(据我所知):
<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>
如果需要任何额外的信息,那么我很乐意并愿意提供。如果有任何不清楚的地方,请询问,我会尽力澄清。
非常感谢任何帮助!
编辑:格式化、记录信息
【问题讨论】:
标签: web-services security ssl iis-6 client-certificates