WCF分布式開發常見錯誤(24):Could not establish trust relationship for the SSL/TLS secure channel with authority
使用傳輸安全模式,認證建立SSL,宿主連接埠認證配置完畢,但是客戶調用服 務出錯。
【1】錯誤資訊:
Could not establish trust relationship for the SSL/TLS secure channel with authority 'computer:9001'.
不能和授權電腦為 SSL/TLS 安全通道建立信任關係.
WCF中文論壇問題串連:http://social.microsoft.com/Forums/zh- CN/wcfzhchs/thread/1591a00d-d431-4ad8-bbd5-34950c39d563
錯誤截圖:
【2】配置資訊:
2.1服務端配置:
服務端設定認證,不採用用戶端安全認證。安全方式是傳輸安全。服務端配 置資訊如下:
<services>
<service behaviorConfiguration="WCFService.WCFServiceBehavior" name="WCFService.WCFService" >
<endpoint
address="WCFService"
binding="wsHttpBinding"
bindingConfiguration="BasicWithTransport"
contract="WCFService.IWCFService">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://computer:9001/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCFService.WCFServiceBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<serviceCertificate storeName="My" x509FindType="FindBySubjectName" findValue="WCFHTTPS" storeLocation="LocalMachine"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="BasicWithTransport">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>