【发布时间】:2019-10-27 05:10:07
【问题描述】:
我有一个 WCF 服务,它公开了一种接收内容的方法。客户端将通过 Internet 使用此服务。客户提供以下证书并在我的本地机器上安装如下:
Comodo 中级 .cert 1) 中级认证机构 > Comodo 中级
Comodo 根 .cert 2) 受信任的根证书颁发机构 > Commodo Root
X509 客户端证书 .pem 3) Trusted People Store > 客户端证书
我想测试/模拟一个客户端调用来测试我在本地运行的 web 服务。我安装了证书并将以下绑定添加到我的 WCF 服务配置中
<protocolMapping>
<add scheme="https" binding="wsHttpBinding"/>
</protocolMapping>
<bindings>
<wsHttpBinding>
<binding>
<security mode="Transport">
<transport clientCredentialType="Certificate"></transport>
</security>
</binding>
</wsHttpBinding>
</bindings>
我创建了一个测试客户端控制台应用程序并添加了以下配置
<behaviors>
<endpointBehaviors>
<behavior name="endpointCredentialBehavior">
<clientCredentials>
<clientCertificate findValue="ClientCertificate"
storeLocation="LocalMachine"
storeName="My"
x509FindType="FindBySubjectName" />
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="Binding1">
<security mode="Transport">
<transport clientCredentialType="Certificate"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
我知道在测试和生产环境中,我有一个服务器证书,但是要在本地成功地测试这一切,我是否需要创建一个服务器证书以及如何创建。这可以在同一个盒子上完成,还是我必须使用 SOAP UI 或其他东西?
【问题讨论】:
标签: wcf certificate