2013-03-27 225 views
9

我試圖調用WCF服務。我創建了一個自簽名證書並安裝在我的LOCALMACHINE \的personnal \證書的,也是我補充說,在我的部分。但我不明白爲什麼這個錯誤是。WCF錯誤未提供客戶端證書。指定ClientCredentials客戶端證書

這裏是我的web.config

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.serviceModel> 
     <bindings> 
      <wsHttpBinding> 
       <binding name="wsHttpEndpoint"> 
        <security mode="Transport"> 
         <transport clientCredentialType="Certificate" /> 
        </security> 
       </binding> 
      </wsHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="https://abcdxyz.abc.syntax.com/TestCCService.svc" 
       binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint" 
       contract="TestCCService.ITestCCService" name="wsHttpEndpoint" /> 
     </client> 

     <behaviors> 
      <endpointBehaviors> 
       <behavior name="CustomBehavior"> 
        <clientCredentials> 
         <clientCertificate findValue="abc.mymachine.name.com" x509FindType="FindBySubjectName" 
          storeLocation="LocalMachine" storeName="My" /> 
         </clientCredentials> 
       </behavior> 
      </endpointBehaviors> 
     </behaviors> 

    </system.serviceModel> 
</configuration> 

但是當我嘗試打電話給我服務的方法及其引發錯誤 「未提供客戶端證書。指定ClientCredentials客戶端證書。」

感謝您的建議以解決此錯誤?

+0

WCF聲稱您沒有與「abc.mymachine.name.com」匹配的客戶端證書;你確定你創建它正確嗎? – 2013-03-27 01:46:24

+0

是的,我安裝了「abc.mymachine.name.com」證書。 – Steve 2013-03-27 01:57:10

回答

9

我miised包括behaviorConfiguration = 「CustomBehavior」

<endpoint address="https://abcdxyz.abc.syntax.com/TestCCService.svc" 
       binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint" 
       contract="TestCCService.ITestCCService" name="wsHttpEndpoint" **behaviorConfiguration="CustomBehavior"** /> 

及其工作現在。

感謝您的幫助