2016-07-28 2 views
0

그래서 MSDN을 통해 샅샅이 뒤졌지만 수많은 기사와 SO조차도 여전히 투쟁의 시간 동안 보여줄 것이 없습니다. WCF wsHttpBinding 인증서 보안 협상 예외

그래서 나는이있다 : WCF 서비스는 클라이언트에 의해 소비 될 필요가 난 그냥 원격 엔드 포인트 보안 협상이 실패했기 때문에

보안 채널을 열 수없는 SecurityNegotiationException 타격 유지한다. 이는 채널을 만드는 데 사용 된 EndpointAddress에 EndpointIdentity가 없거나 잘못 지정 되었기 때문일 수 있습니다. EndpointAddress가 지정하거나 묵시하는 EndpointIdentity가 원격 엔드 포인트를 올바르게 식별하는지 확인하십시오.

나는이 오류를 인터넷을 통해 보았으며 아무도 내 정확한 시나리오를 가지고 있지 않습니다 (실현 가능한 답변 이상).

내 설정은 로컬이며 IIS에서 호스팅하지 않지만 Visual Studio 2010을 통해 호스팅됩니다. My GenericIntegration (WCF 서비스)은 인증서로 인증 된 wsHttpBinding (메시지 모드)을 사용합니다 (사용자 정의 사용자 이름/암호 인증 + 인증 클래스는 설계 상 매개 변수로 전달됨) 보안 조치를 철회 할 필요가 없습니다.

호스트의 구성

<system.serviceModel> 
<bindings> 
    <wsHttpBinding> 
    <binding name="wsHttpEndpintBinding"> 
     <security mode ="Message"> 
     <message clientCredentialType="Certificate" establishSecurityContext="false" negotiateServiceCredential="false"/> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<services> 
    <service behaviorConfiguration="wsHttpBehaviour" name="GenericIntegration.GenericService"> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpEndpintBinding" 
     name="wsHttpEndpoint" contract="GenericIntegration.GenInterface" /> 
    <host> 
     <baseAddresses> 
     <!--<add baseAddress="http://localhost:59082/GenericService.svc" />--> 
     </baseAddresses> 
    </host> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="wsHttpBehaviour"> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
     <serviceCredentials> 
     <clientCertificate> 
      <certificate findValue="GenIntegrationClient" storeName="My" storeLocation="LocalMachine" x509FindType="FindBySubjectName" /> 
      <authentication certificateValidationMode="PeerTrust" /> 
     </clientCertificate> 

     <serviceCertificate findValue="GenIntegrationClient" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" /> 
     </serviceCredentials> 
    </behavior> 
    <behavior name="metadataBehavior"> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors>  

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

그리고 클라이언트의 설정 인증서에 대한 지금

<system.serviceModel> 
    <behaviors> 
     <endpointBehaviors> 
      <behavior name="endpointBehaviour"> 
       <clientCredentials> 
        <clientCertificate findValue="GenIntegrationClient" storeLocation="LocalMachine" storeName="My" 
         x509FindType="FindBySubjectName" /> 
        <serviceCertificate> 
        <authentication certificateValidationMode="PeerTrust" revocationMode="NoCheck"/> 
        </serviceCertificate> 
       </clientCredentials> 
      </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    <bindings> 
     <wsHttpBinding> 
      <binding name="wsHttpEndpoint" maxBufferPoolSize="20000000" maxReceivedMessageSize="20000000"> 
       <security mode="Message"> 
        <message clientCredentialType="Certificate" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://localhost:59082/GenericService.svc" 
      binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint" behaviorConfiguration="endpointBehaviour" 
      contract="GenService.GenInterface" name="wsHttpEndpoint"> 
      <identity> 
       <certificate encodedValue="AwAAAAEAAAAUAAAAKdyUELIKMtdh2MFsYQ09ja+vyeEgAAAAAQAAACICAAAwggIeMIIBi6ADAgECAhCFBfF1EXQZhkPKaBpQCl84MAkGBSsOAwIdBQAwJDEiMCAGA1UEAxMZNE1PU1RHZW5JbnRlZ3JhdGlvblNlcnZlcjAeFw0xNjA3MjgxNDQ5MjVaFw0zOTEyMzEyMzU5NTlaMCQxIjAgBgNVBAMTGTRNT1NUR2VuSW50ZWdyYXRpb25DbGllbnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAIwsIlz5nZ3HxeYofTpYKr6RcfQMe/jZxPuHcljT+8pBOZ6KmYcyxeRTO074yP6yF8b1IqFskII+qqmCT8nDsb8xdo5Ee0oqL1LKR+xeTgg2ZXXoocxqR1AdxWFVdlMxMSjKIEGE+MnSDdB6vgXahhpUbAS7cdrNoAFKNIz+vrt1AgMBAAGjWTBXMFUGA1UdAQROMEyAEB4cu6OjBqQHct6przmowGyhJjAkMSIwIAYDVQQDExk0TU9TVEdlbkludGVncmF0aW9uU2VydmVyghD75YH5y52zsU5wcmZLJzPiMAkGBSsOAwIdBQADgYEA2BinUmEfgZKcb1qFD1T5ajc2OWHGLjDLpDi8Y7amM4P3rFGvelx7NmCNUH88iGS9LcbDsmY59HcZwUavtPOr4LMRDhl+5YuGht1fIYEk8QSDIhjevijgDOIVBBAeNIA8tva1faMNtYnFXsj0VxMvlrZ4exeKFVFjv2sib5YNFxY=" /> 
      </identity> 
     </endpoint> 
    </client> 
</system.serviceModel> 

(그리고 예이 테스트 용으로 만 것입니다) : GenIntegrationServer. cer가 클라이언트 인증서에 서명 할 개인 키가있는 자체 서명 된 CA 루트 인증서로 생성됩니다. GenIntegrationServer 및 GenIntegrationClient 인증서는 makecert으로 생성되었습니다. 클라이언트 인증서는 개인 키에 연결되며 개인 저장소에 올바르게 설치됩니다.

저는 인증서, 개인 키 및 보안 통신에 여전히 새로운 점이 있습니다. 실수를해서는 안됩니다. 이런 방식으로 인증서를 사용하는 것에 대해 너무 많은 게시물을 찾지 못했습니다.

더 많은 모발을 잃거나 잠을 자기 전에 아무도 도와 줄 수 있습니까? 요청에 따라

UPDATE

는 I 로깅을 첨가. 그러나 그들이 밝힌 대부분은 다음과 같습니다.

슬프게도 보안 유효성 검사가 실패하는 이유를 아직 알지 못합니다. 어떤 아이디어?

+0

자세한 정보 로깅을 위해 서비스 클라이언트와 호스트를 구성하십시오 (https://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx). 협상이 실패 할 때 내부적으로 어떤 일이 잘못 될지 더 잘 알 수 있습니다. 이 정보를 사용하여 문제를 해결하거나 추가 정보가 있으면보다 구체적인 질문을하십시오. – asawyer

+0

또한 설치 프로그램의 일반적인 문제는 IIS 서비스 계정에 개인 키에 대한 읽기 권한이 없다는 것입니다. WSE3.0 도구를 설치 한 다음 인증서 도구를 사용하여 개인 키 사용 권한을 부여하십시오. – asawyer

+0

요청 당 로깅을 추가했습니다. 나는 결과를 가지고 나의 질문을 편집 할 것이다. – Medismal

답변

-1

밖으로 나옵니다 다른 상점에 인증서를 추가해야했습니다.

개인 저장소 (config에 표시된대로)에 인증서가 이미 설정되어있는 것 외에 클라이언트의 서버 인증서를 설치해야했고 그 반대의 경우도 마찬가지였습니다. 나는 또한 클라이언트가 클라이언트 인증서의 개인 키를 포함하고 서버와 동일한 지 확인해야했다.

이것은 너무 이상하게 들리지는 않지만 내가 어떻게했는지에 대한 전체 기사를 게시 할 예정입니다.

+0

자신의 질문에 대한 해결책을 찾으면 자신의 대답을 정답으로 표시 할 수 있다는 점에 유의하십시오. –