2016-08-05 99 views
0

我知道關於堆棧溢出有很多問題,但沒有一個是最近的,似乎沒有解決我的問題最充分。Wcf服務拋出異常:無法建立具有權限的SSL/TLS安全通道的信任關係

情況如下:

我們有一個在IIS 6.2上運行的web服務。 web服務被配置爲只接受https流量。網站上的綁定配置爲在默認端口443上的所有可用IP地址上使用HTTPS。所選ssl證書是購買的專用證書。

該網站是一個專門的應用程序池中運行,用專用的用戶

證書鏈安裝在Web服務器,本地機器下在以下位置:

  • 根CA - 可信根證書頒發機構
  • 組織驗證CA - 中間證書頒發機構
  • PFX證書 - 個人

在pfx證書中,我授予'管理私鑰'選項中的專用用戶讀權限。在調試時我還授予以下帳戶的讀取權限:

  • network服務
  • IUSR
  • iis_iusr

我已經添加了診斷的WebService創建svclog並啓用日誌記錄IIS上的web服務實例。這兩個日誌似乎都沒有任何信息。

在解決問題時,我嘗試運行本地測試客戶端。爲此,我需要在當前用戶的個人存儲中安裝* .cer文件。

請注意,我們在網絡服務器上試過這個,但也在本地機器上試過。這兩個結果在以下錯誤消息:

無法建立信任關係與權力my.domain.com

客戶端的配置的SSL/TLS安全通道:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup> 
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> 
    </startup> 
    <system.serviceModel> 
     <bindings> 
      <basicHttpsBinding> 
       <binding name="*MyServiceBinding*" sendTimeout="00:05:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" > 
        <security mode="Transport"> 
         <transport clientCredentialType="Certificate" /> 
        </security> 
       </binding> 
      </basicHttpsBinding> 
     </bindings> 
     <behaviors> 
      <endpointBehaviors> 
       <behavior name="endpointBehavior"> 
        <clientCredentials > 
         <clientCertificate findValue="my.domain.com" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" /> 
        </clientCredentials> 
       </behavior> 
      </endpointBehaviors> 
     </behaviors> 
     <client> 
      <endpoint address="https://my.domain.com/myService.svc" 
       behaviorConfiguration="endpointBehavior" binding="basicHttpsBinding" 
       bindingConfiguration="myServiceBinding" contract="MyService.IMyService" 
       name="MyServiceEndpoint"> 
       <identity> 
        <certificateReference findValue="my.domain.com" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" isChainIncluded="false" /> 
       </identity> 
      </endpoint> 
     </client> 
    </system.serviceModel> 
</configuration> 

web服務的配置,我只提取相關部分(據我所知):

<bindings> 
    <basicHttpsBinding> 
     <binding name="basicHttpsEndpointBinding"> 
      <security mode="Transport"> 
       <transport clientCredentialType="Certificate"/> 
      </security> 
     </binding> 
    </basicHttpsBinding> 
</bindings> 

<serviceBehaviors> 
    <behavior name="httpsBehaviour"> 
     <serviceMetadata httpsGetEnabled="true" httpGetEnabled="false" httpsGetBindingConfiguration="basicHttpsEndpointBinding" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
     <serviceCredentials> 
      <serviceCertificate findValue="my.domain.com" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/> 
     </serviceCredentials> 
    </behavior> 
</serviceBehaviors> 

<service behaviorConfiguration="httpsBehaviour" name="My.Service.MyService"> 
    <endpoint binding="basicHttpsBinding" bindingConfiguration="basicHttpsEndpointBinding" name="MyServiceEndpoint" contract="My.Service.MyService.Interfaces.IMyInterFace"> 
     <identity> 
      <certificateReference findValue="my.domain.com" isChainIncluded="false" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/> 
     </identity> 
    </endpoint> 
</service> 

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"> 
    <baseAddressPrefixFilters> 
     <add prefix="https://my.domain.com/" /> 
    </baseAddressPrefixFilters> 
</serviceHostingEnvironment> 

如果需要額外的信息,那麼我很高興並願意提供。如果有什麼不清楚的地方,請提問,我會盡可能地澄清。

任何幫助,非常感謝!

編輯:格式,日誌信息

回答

1

最終我用下面的計算器問題解決了這個問題:

HTTP error 403.16 - client certificate trust issue

總之

,微軟已經在Windows Server 2012,這意味着更新其安全如果在受信任的根證書頒發機構店存在其中標的不等於任何證書,該服務將返回一個403.16 HTTP異常。

由IIS中C記錄錯誤消息:\的Inetpub \日誌\ LogFiles文件\ W3SV *。 '*'是IIS中您的網站的ID。

要知道,IIS的日誌記錄被添加到日誌文件的時間間隔!

審查我來到翻過了403.16例外,來到上面的堆棧溢出問題的日誌文件之後。

我刪除了我們添加的所有證書,這些證書是自簽名的,發行人和主題不匹配。這解決了這個問題。

相關問題