WCF使用了证书部署问题。
使用了宿主成Windows Service的WCF,客户端是一个Web Application,通过TCP/IP来使用这个服务,通过证书来验证客户端。
现在在开发环境运行很好。但是部署到产品环境后,服务可以启动,客户端却不能调用这个服务了。抛出如下异常。
The credentials supplied to the package were not recognized。
客户端的配置(节选):
<endpoint address="net.tcp://100.50.0.9:1234/EmployeeInfoService" binding="netTcpBinding" behaviorConfiguration="SecurityBehavior" bindingConfiguration="SecurityBind" contract="A.IEmployeeInfo" name="IEmployeeInfo">
<identity>
<dns value="Server"></dns>
</identity>
</endpoint>
<endpointBehaviors>
<behavior name="SecurityBehavior">
<clientCredentials>
<clientCertificate findValue="Client" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
<serviceCertificate>
<authentication certificateValidationMode="None" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
<binding name="SecurityBind" >
<security mode="Transport">
<transport clientCredentialType="Certificate" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>