2013-03-27 227 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"** /> 

及其工作现在。

感谢您的帮助