2016-09-23 8 views
1

Windows 인증 (https)을 사용하도록 IIS WCF 웹 서비스를 설정하고 WSDL에 액세스 할 때 서버에서 인증을 요청합니다 , 그러면 작동합니다. 그래서 모든 것이 잘됩니다.WCF : 권한이 SSL/TLS 보안 채널에 대한 트러스트 관계를 설정할 수 없습니다.

그러나 현재 사용자의 Windows 자격 증명을 전달하는 방법을 알 수 없으므로 주제에 자세한 오류가 계속 나타납니다.

ConfigurationChannelFactory<ITRIMService> channelFactory = new ConfigurationChannelFactory<ITRIMService>("BasicHttpBinding_ITRIMService", config, null); 
var channel = channelFactory.CreateChannel(); 

내가 시도 :

<?xml version="1.0" encoding="utf-8" ?> 
    <configuration> 
     <system.serviceModel> 
      <bindings> 
       <wsHttpBinding> 
        <binding name="BasicHttpBinding_ITRIMService"> 
        <security mode="Transport"> 
         <transport clientCredentialType="Windows" proxyCredentialType="None" /> 
         <message clientCredentialType="Windows" negotiateServiceCredential="true"/> 
        </security> 
        </binding> 
       </wsHttpBinding> 
      </bindings> 
      <client> 
       <endpoint address="https://servername.net/TRIMDev/TRIMService.svc" 
        binding="wsHttpBinding" bindingConfiguration="BasicHttpBinding_ITRIMService" 
        contract="Service.ITRIMService" name="BasicHttpBinding_ITRIMService"> 
        <identity> 
         <servicePrincipalName value="host/servername.net" /> 
        </identity> 
       </endpoint> 
      </client> 
     </system.serviceModel> 
    </configuration> 

이 궁극적으로 채널을 생성하는 코드는 다음과 같습니다

<?xml version="1.0" encoding="UTF-8"?> 
    <configuration> 
    <system.serviceModel> 

     <bindings> 
     <wsHttpBinding> 
      <binding name="wsBindingTest"> 
      <security mode="Transport"> 
       <message negotiateServiceCredential="true" clientCredentialType="Windows"/> 
       <transport clientCredentialType="Windows"/> 
      </security> 
      </binding> 
     </wsHttpBinding> 
     </bindings> 

     <protocolMapping> 
     <remove scheme="http" /> 
     <add scheme="http" binding="wsHttpBinding" bindingConfiguration="wsBindingTest" /> 
     </protocolMapping> 

     <behaviors> 
     <serviceBehaviors> 
      <behavior name=""> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      </behavior> 
     </serviceBehaviors> 
     </behaviors> 

     <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
    </configuration> 

이 클라이언트입니다 :

는 서버의 web.config입니다 행운과 함께 클라이언트 설정에 다음을 추가하면 t에 아무 것도 코딩하지 않아도 될 수 있기를 바랄 뿐이다. 그는 클라이언트 :

<system.web> 
     <identity impersonate="true"/> 
     <authentication mode="Windows" /> 
    </system.web> 

아무런 도움이되지 않을 것입니다. 나는 왜 그것이 작동하지 않는지 알기에 충분하지 않습니다.

답변

0

wsHttpBinding 이상의 Windows 인증은 작동하지 않으며 NetTcpBinding에 대해서만 지원됩니다. 참조 정보 here.

+0

저는 그렇게 생각하지 않습니다. wsHTTPbinding은 현재 버전이고 wsBasic은 유산입니다. 그러나 나는 작동하지만 완전히 확신 할 수는 없습니다. 그 부분이 섹션이라면 작동하지만, 제거되면 익명 성을 통과합니다. –