[英]How do I setup SSL over WCF?
我在生產環境中收到的錯誤:
根據驗證過程,遠程證書無效。
[AuthenticationException:根據驗證過程,遠程證書無效。] System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken消息,AsyncProtocolRequest asyncRequest,異常異常)+2755308
System.Net.Security.SslState.StartSendBlob(字節[]傳入,Int32計數,AsyncProtocolRequest asyncRequest)+470
生產環境使用三層體系結構,即Web與App對話和App與數據庫對話。 Web和App使用WCF服務層通過SSL進行通信(443)。 我們認為它可能是IIS7中的SSL證書中的配置,也可能是WCF配置問題。
我們嘗試的操作:我在“應用程序”和“ Web”中都將證書添加到“本地計算機”和“當前用戶”的受信任的授權機構。
如果需要,我可以添加WCF Web Config。
我嘗試了以下建議:
https://msdn.microsoft.com/zh-CN/library/ms734695.aspx
“根據驗證過程,遠程證書無效。” 使用Gmail SMTP服務器
https://msdn.microsoft.com/zh-CN/library/ms733813(v=vs.110).aspx
https://msdn.microsoft.com/zh-CN/library/hh556232%28v=vs.110%29.aspx
這個答案是針對客戶端證書的,您要在其中將帶有有效負載的證書發送到HTTPS端點。
您需要確保信任證書,信任創建證書的證書頒發機構,並且在受信任的存儲區中擁有該CA的證書。
您是否可以在系統上需要提供證書的簡單網頁(不是WCF服務)上找到? 即: https://mysite/test.aspx這將允許您測試WCF之外的證書,並使您可以將WCF問題與IIS問題分開。
1)確保已在IIS中設置證書映射。 http://www.iis.net/configreference/system.webserver/security/authentication/clientcertificatemappingauthentication http://blogs.msdn.com/b/asiatech/archive/2014/02/13/how-to-configure-iis iis7.aspx的客戶端證書映射身份驗證
短tl; dr; 對於我們的工作:
https://msdn.microsoft.com/zh-CN/library/windows/desktop/aa384088%28v=vs.85%29.aspx
2)確保您的web.config設置正確(我們的示例允許通過HTTP和HTTPS命中端點)
<bindings>
<basicHttpBinding>
<!-- Secure Bindings -->
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
<binding name="httpBinding">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<!-- Person Revised Service-->
<service name="Services.PRPA_AR101202" behaviorConfiguration="ServiceBehaviour">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="Services.IPRPA_AR101202"></endpoint>
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="httpBinding" contract="Services.IPRPA_AR101202" />
</service>
</services>
同樣,此答案適用於帶有消息的客戶端證書,如果只是常規HTTP,則可以忽略它
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.