无法找到x509 Cert WCF错误

时间:2012-11-06 13:23:10

标签: .net wcf wcf-security

我创建了一个wcf并在服务器上部署了ssl。我可以通过在浏览器中使用url来访问服务,并且可以看到元数据但无法从客户端访问它。我收到错误,因为找不到X509证书。请查找我在客户端和服务端使用的配置文件。我将wcf与证书一起安装在服务器上,并尝试从本地计算机访问它。我是否需要在本地计算机上执行任何操作才能访问证书。

服务:

<system.serviceModel>    
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttpBinding">         
          <security mode="Transport">
            <transport clientCredentialType="Basic"/>
            <message clientCredentialType="None"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="testBehavior" name="TestService">
        <endpoint address="wsHttpBinding"
          binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" name="sWsHttpBinding"
          contract="ITestContract" >
        </endpoint>
      </service>
    </services>
    <behaviors>      
      <serviceBehaviors>
        <behavior name="testBehavior">
          <serviceDebug includeExceptionDetailInFaults="true" />                 
          <serviceCredentials>
            <clientCertificate>
              <authentication certificateValidationMode="None" revocationMode="NoCheck"/>
            </clientCertificate>
            <serviceCertificate findValue="112337B641609C08C6AEAA01FDFDFDFDFASF2334"
              storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="True"></serviceHostingEnvironment>
  </system.serviceModel>

Client:
<system.serviceModel>
  <bindings>
    <wsHttpBinding>
      <binding name="wsHttpBinding">
        <security mode="Transport">
          <transport clientCredentialType="Basic" />
        </security>
      </binding>
    </wsHttpBinding>
  </bindings>
  <client>   
    <endpoint address="http://myserver/sWsHttpBinding"
         behaviorConfiguration="endpointBehavior" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding"
        contract="ITestContract" name="sWsHttpBinding">
    </endpoint>
  </client>
  <behaviors>
    <endpointBehaviors>
      <behavior name="endpointBehavior">
        <clientCredentials>
          <serviceCertificate>
            <authentication certificateValidationMode="PeerTrust" revocationMode="NoCheck"/>
          </serviceCertificate>
          <clientCertificate storeLocation="LocalMachine" storeName="My" findValue="112337B641609C08C6AEAA01FDFDFDFDFASF2334" x509FindType="FindByThumbprint"/>
        </clientCredentials>
      </behavior>
    </endpointBehaviors>
  </behaviors>
</system.serviceModel>

0 个答案:

没有答案