2013-07-11 134 views
0

我有IIS7上託管的WCF服務。此服務既是從Silverlight客戶端,也是從C#Windows服務中調用的。目前一切運行在同一臺機器上。 它使用一個自簽名證書,並使用certmgr.msc將其導入到受信任根中的一個自簽名證書。從Windows服務調用WCF服務時出現證書錯誤

Silverlight應用程序可以調用該服務,但是當Windows服務嘗試調用該服務時,我得到以下異常:

System.ServiceModel.Security.SecurityNegotiationException: Could not establish trust 
relationship for the SSL/TLS secure channel with authority 'localhost'. ---> 
System.Net.WebException: The underlying connection was closed: Could not establish 
trust relationship for the SSL/TLS secure channel. ---> 
System.Security.Authentication.AuthenticationException: The remote certificate is 
invalid according to the validation procedure.  

什麼是Windows服務將被拒絕訪問,同時在瀏覽器和Silverlight應用程序可以訪問通過https服務的原因是什麼? 是否可能是因爲客戶端證書指紋必須與Windows服務綁定?

(我對SSL驗證的工作很陌生,如你所見)。

謝謝

+0

如果您想忽略SSL,此答案顯示另一個解決方案; http://stackoverflow.com/questions/109186/bypass-invalid-ssl-certificate-errors-when-calling-web-services-in-net – arame3333

回答

0

我發現了這個問題。 原來我只將CA導入當前的用戶存儲而不是本地計算機存儲,所以Windows服務找不到它。

相關問題