簡體   English   中英

從Windows服務調用WCF服務時出現證書錯誤

[英]Certificate error when calling WCF service from Windows Service

我在IIS7上托管了WCF服務。 從Silverlight客戶端和C#Windows服務均可調用此服務。 目前,所有內容都在同一台計算機上運行。 它使用具有授權.cer文件的自簽名證書,我使用certmgr.msc將其導入到受信任的根目錄中

Silverlight應用程序可以很好地調用該服務,但是當Windows Service嘗試調用該服務時,出現以下異常:

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.    

當瀏覽器和Silverlight應用程序可以通過https訪問該服務時,拒絕Windows服務的原因是什么? 可能是因為客戶端證書指紋必須與Windows服務綁定嗎?

(如您所見,我對SSL身份驗證的工作還是很陌生的)。

謝謝

我發現了問題。 原來,我僅將CA導入到當前的用戶存儲中,而不是將其導入到本地計算機存儲中,因此Windows服務找不到它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM