2012-10-28 4 views
1
나는 다음과 같은 인프라가

에 액세스 할 수 없습니다 :WCF 위임이 서비스는 SQL 서버

  • 컴퓨터 # 1, Microsoft SQL Server 2008을, 시스템 계정으로 시작했다. 로그인 Master\MyLogin (Windows Authintification 사용), 서버 역할 = sysadm, 데이터베이스 역할 = db_owner이 있습니다.

  • 컴퓨터 # 2, IIS 7.0의 WCF 서비스. 그것은 첫째 EF 5.0 데이터베이스를 사용

    <configuration> 
        <system.web> 
        <compilation debug="true" /> 
        </system.web> 
        <system.serviceModel> 
        <bindings> 
         <netTcpBinding> 
         <binding name="CommonWindowsBinding" maxReceivedMessageSize="40000000"> 
          <security mode="TransportWithMessageCredential"> 
          <transport clientCredentialType="Windows" /> 
          </security> 
         </binding> 
         </netTcpBinding> 
        </bindings> 
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
        <services> 
         <service behaviorConfiguration="CommonBehavior" name="MyNameSpace.AdminService"> 
         <endpoint address="Windows" binding="netTcpBinding" bindingConfiguration="CommonWindowsBinding" name="IAdminServiceWindows" contract="MyNameSpace.IAdminService"> 
          <identity> 
          <dns value="WCFServer" /> 
          <userPrincipalName value="[email protected]"/> 
          </identity> 
         </endpoint> 
         </service> 
        </services> 
        <behaviors> 
        <serviceBehaviors> 
        <behavior name="CommonBehavior"> 
         <dataContractSerializer maxItemsInObjectGraph="10000000" /> 
         <serviceMetadata httpGetEnabled="true" policyVersion="Policy15" /> 
         <serviceDebug includeExceptionDetailInFaults="true" /> 
         <serviceCredentials> 
         <clientCertificate> 
          <authentication certificateValidationMode="PeerTrust" /> 
         </clientCertificate> 
         <serviceCertificate findValue="WCFServer" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" /> 
         <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MyClassFullName, MyDllFullName" /> 
         </serviceCredentials> 
        </behavior> 
        </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
    </configuration> 
    

    서비스는이 방법

    [OperationBehavior(Impersonation = ImpersonationOption.Allowed)] 
    public bool HasRole(string roleName) 
    { 
        //work with database 
    } 
    

    : 응용 프로그램 및 사이트 계정 Master\IISLogin ([email protected])

구성에서 실행됩니다. 연결 문자열

"Data Source=Computer1; Initial Catalog=myDB; Integrated Security=True; Multipleactiveresultsets=True; Persist Security Info=True;" 
  • 컴퓨터 # 3, 클라이언트. 그것은

    <configuration> 
    <system.serviceModel> 
        <bindings> 
        <netTcpBinding> 
         <binding name="CommonWindowsBinding" closeTimeout="00:01:00" 
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
          transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" 
          hostNameComparisonMode="StrongWildcard" listenBacklog="10" 
          maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" 
          maxReceivedMessageSize="40000000"> 
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
           maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
          <reliableSession ordered="true" inactivityTimeout="00:10:00" 
           enabled="false" /> 
          <security mode="TransportWithMessageCredential"> 
          <transport clientCredentialType="Windows" /> 
          </security> 
         </binding> 
        </netTcpBinding> 
    </bindings> 
    <client> 
        <endpoint name="Megatec.MasterTourService.Contracts.IAdminServiceWindows" 
         address="net.tcp://Computer2:5012/IISTest/AdminService.svc/Windows" 
         behaviorConfiguration="CustomBehavior" 
         binding="netTcpBinding" 
         bindingConfiguration="CommonWindowsBinding" 
         contract="Megatec.MasterTourService.Contracts.IAdminService"> 
         <identity> 
          <dns value="WCFServer" /> 
         </identity> 
        </endpoint>   
    </client> 
    <behaviors>   
        <behavior name="CustomBehavior"> 
        <dataContractSerializer maxItemsInObjectGraph="10000000"/> 
        <clientCredentials> 
         <clientCertificate findValue="WCFClient" x509FindType="FindBySubjectName" 
          storeLocation="LocalMachine" storeName="My" /> 
          <serviceCertificate> 
           <defaultCertificate findValue="WCFServer" storeLocation="LocalMachine" 
                x509FindType="FindBySubjectName" /> 
           <authentication certificateValidationMode="PeerTrust" 
               revocationMode="NoCheck" 
               trustedStoreLocation="LocalMachine"/> 
          </serviceCertificate> 
          </clientCredentials> 
         </behavior> 
         </endpointBehaviors> 
        </behaviors> 
        </system.serviceModel> 
    </configuration> 
    

채널

channelFactory.Credentials.Windows.AllowedImpersonationLevel = 
    System.Security.Principal.TokenImpersonationLevel.Delegation; 
channelFactory.Credentials.Windows.ClientCredential = 
    System.Net.CredentialCache.DefaultNetworkCredentials; 

그것은

로그인 'NT AUTHORITY \ 익명' 사용자에 대한 실패 DB 오류로 떨어지면 다음의 자격 증명이 다음과 같은 설정을 가지고

그래서 WCF 위임에 몇 가지 문제가 있습니다. 간단한 username/password 인증을 사용하려고하면 정상적으로 작동하므로 인증서 등이 문제가되지 않습니다.

this instruction에 4 단계를 수행했지만 작동하지 않습니다.

아마도 내 코드 또는 configs에 문제가 있습니까? 어떻게 해결할 수 있습니까?

업데이트.

  1. 시도 (NO 결과)

    [인 OperationBehavior (도용은 = ImpersonationOption.Allowed)] => [인 OperationBehavior (도용은 = ImpersonationOption.Required)]

  2. 시도 (NO 결과)

    서비스 측면에서

  3. ServiceSecurityContext.Current.WindowsIdentity.ImpersonationLevel = 가장 (위임이 아님!)

  4. IIS 풀의 ID를 ApplicationPoolIdentity에서 [email protected]로 변경하려고하면 컴퓨터 3의 클라이언트가 충돌합니다. 당신의 COMPUTER3의 설정에서

답변

0

불행히도 Transport/TransportWithMessageCredential 보안 모드는 클라이언트 자격 증명 및 위임과 관련된 작업을 지원하지 않습니다. 내가 아는 한 나는, 위임을 지원하지 않는 다음과 같은 방법

서버

<binding name="CommonWindowsBinding" maxReceivedMessageSize="40000000"> 
     <security mode="Message"> 
     <message clientCredentialType="Windows" /> 
     </security> 
    </binding> 

클라이언트

<binding name="CommonWindowsBinding" closeTimeout="00:01:00" 
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
     transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" 
     hostNameComparisonMode="StrongWildcard" listenBacklog="10" 
     maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" 
     maxReceivedMessageSize="40000000"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <reliableSession ordered="true" inactivityTimeout="00:10:00" 
      enabled="false" /> 
     <security mode="Message"> 
     <message clientCredentialType="Windows" /> 
     </security> 
    </binding> 
1

시도 (현재 <behaviors>...</behaviors> 블록 대신에) 다음 : 당신은 또한 컴퓨터 2에 설치 Active Directory에 기록해야 할 수도 있습니다 편집 자격 증명 위임에 컴퓨터 1 할 수 있도록

<behaviors> 
    <endpointBehaviors> 
    <behavior name="CustomBehavior"> 
     <clientCredentials> 
     <!--<windows allowNtlm="false" allowedImpersonationLevel="Delegation" />--> 
     <windows allowNtlm="true" allowedImpersonationLevel="Delegation" /> 
     </clientCredentials> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 

"모든 유형"(Kerberos 만 해당)

+1

NTLM에 CommonWindowsBinding을 변경했습니다. Kerberos만이 가능합니다. –

+0

@SirHally 편집 : remark에서 언급했듯이 "모든 유형"의 위임을 허용하도록 AD를 설정해야하며 NTML을 사용하여 위임 할 수 있습니다.이 정확한 방법을 사용하여 웹 서비스에서 NTLM을 사용하여 Exchange에 위임 할 수 있습니다. – Seph

관련 문제