2012-05-17 1 views
1

IIS 7에서 SSL을 사용하여 WCF 웹 서비스를 설정하려고하는데 설정 파일이 약간 손실됩니다. 서버에서 클라이언트로 데이터가 왜곡됩니다 (SSL로 충분합니까?) 클라이언트는 인증서를 통해 서버 자체를 식별해야합니다.SSL 및 인증서를 사용하여 WCF 설정 파일을 설정하는 중

나는 자리에 다음과 같은 인증서가 :

  • dev.test.com - URL에 https://dev.test.com/TestService.svc 액세스하는 자리에서이 유효한 인증서가 있음을 보여줍니다.
  • TESTSERVER - 서버를 식별하는 더미 인증서
  • (??? 나는이 필요 아니면 내가 dev.test.com 어쩌면이 server.test.com을 다시 사용할 수 있습니다 정말 필요합니까) TestClient을 - 더미 클라이언트 측

을에 인증서 그리고 이것은 내 설정 파일을 설정하는 방법은 다음과 같습니다

Web.conf IG (서버) :

<bindings> 
    <wsHttpBinding> 
    <binding name="wsHttpEndpointBinding" 
      messageEncoding="Mtom"> 
     <security mode="Message"> 
     <transport clientCredentialType="None" /> 
     <message clientCredentialType="Certificate" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

<services> 
    <service 
    name="TestService" 
    behaviorConfiguration="TestServiceBehavior"> 
    <endpoint 
     name="TestEndPoint" 
     address="" 
     binding="wsHttpBinding" 
     bindingConfiguration="wsHttpEndpointBinding" 
     bindingNamespace="http://www.example.com/" 
     contract="iWebService"> 
     <!--<identity> 
     <dns value=""/> 
     </identity>--> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="" name="MexHttpsBindingEndpoint" contract="IMetadataExchange"/> 
    </service> 
</services> 

<behaviors> 
    <serviceBehaviors> 
    <behavior name="TestServiceBehavior"> 
     <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" /> 
     <serviceCredentials> 
     <clientCertificate> 
      <authentication certificateValidationMode="PeerOrChainTrust" /> 
     </clientCertificate> 
     <serviceCertificate findValue="TestServer" storeLocation="LocalMachine" 
      storeName="My" x509FindType="FindBySubjectName" /> 
     </serviceCredentials> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

의 App.config (클라이언트) :

<bindings> 
    <wsHttpBinding> 
    <binding name="wsHttpBinding" bypassProxyOnLocal="false" 
     transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
     messageEncoding="Mtom" textEncoding="utf-8" useDefaultWebProxy="true" 
     allowCookies="false"> 
     <reliableSession ordered="true" 
     enabled="false" /> 
     <security mode="Message"> 
     <transport clientCredentialType="None" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="Certificate" negotiateServiceCredential="true" 
      algorithmSuite="Default" /> 
     </security> 
    </binding> 
    <binding name="TestEndPoint" bypassProxyOnLocal="false" 
     transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
     messageEncoding="Mtom" 
     textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
     <reliableSession ordered="true" 
     enabled="false" /> 
     <security mode="Transport"> 
     <transport clientCredentialType="None" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="Certificate" negotiateServiceCredential="true" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 

<client> 
    <endpoint address="https://dev.test.com/TestService.svc" 
    behaviorConfiguration="TestServiceBehavior" 
    binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" 
    contract="IContractName" name="wsHttpBinding"> 
    <identity> 
     <dns value="TestServer" /> 
    </identity> 
    </endpoint> 
    <endpoint address="https://dev.test.com/DistributionCenterService.svc" 
    binding="wsHttpBinding" bindingConfiguration="TestEndPoint" contract="IContract.Name" 
    name="TestEndPoint" /> 
</client> 

<behaviors> 
    <endpointBehaviors> 
    <behavior name="TestServiceBehavior"> 
     <clientCredentials> 
     <clientCertificate findValue="TestClient" 
          storeName="My" 
          storeLocation="CurrentUser" 
          x509FindType="FindBySubjectName"/> 
     <serviceCertificate> 
      <authentication 
      certificateValidationMode="PeerOrChainTrust" 
      revocationMode="NoCheck" 
      trustedStoreLocation="CurrentUser"/> 
     </serviceCertificate> 
     </clientCredentials> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 

나는 https://dev.test.com/TestService.svc에 액세스하려고, 내가
를 얻을 수 Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [https].

어쨌든, 내가 사용하고 있어야하는 구성 설정으로 인해 정말로 분실했습니다.

답변

1

나는 https를 사용할 수 있다고 믿는다. 클라이언트의 wsHttpBinding 보안 모드는 전송 또는 (아마도 귀하의 경우) TransportWithMessageCredential이어야합니다.

+0

클라이언트 용입니까? 서버 측은 어떻습니까? – kei

+0

어쩌면 거기에 - 나는 당신이 얻고있는 첫 번째 오류에 집중하고있었습니다. –

+0

알겠습니다. 내가 이것을 밖으로 시험하게 해주세요. – kei

관련 문제