2013-06-06 2 views
0

Windows 인증이있는 WCF 서비스가 있습니다. 다른 서버에 배포 한 후 나는 다음과 같은 예외가받은 :배포 후 WCF windows 인증이 작동하지 않습니다.

System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized

클라이언트 구성이 변경되지 않습니다 및 다음과 같습니다

<ws2007HttpBinding> 
    <binding name="autoSecureBinding"> 
    <security mode="TransportWithMessageCredential"> 
     <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""></transport> 
     <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="false"/> 
    </security> 
    </binding> 
</ws2007HttpBinding> 

편집 : 나는 브라우저에서 내 서비스를 열면 I

Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.

이 에게

아무도 알고 있나요 이 일 수 있던 무엇이 : 다음과 같은 오류가 나타날 수 전자 문제?

답변

0

다른 서버가 동일한 활성 디렉토리 도메인에 있습니까?

또한 대상 IIS로 이동하여 사이트/응용 프로그램 인증 설정에 "Windows 인증"을 "사용함"으로 설정했는지 확인하려고합니다. Authentication settings icon

다음

Enable window authentication

+0

Windows 인증을 사용하고 익명을 사용할 수 없습니다. 새 서버가 동일한 AD 도메인에 있습니다. –

+0

흠, 분명히 오류 메시지가 표시되어 익명을 사용하도록 설정해야합니다 ... 사용하도록 설정하는 것이 좋습니다. –

0

는 (만 Windows 인증은 IIS에서 사용 가능) 내가 사용하고 승리를 인증만을 WCF 서비스의 작업의 Web.config입니다 (아래 IIS7에 대한 화면 참조).

옵션 1 :

client.ClientCredentials.Windows.ClientCredential = new NetworkCredential("phil.morris", "P4ssW0rd", "mydomain"); 

옵션 2 :

당신이 WCF에 ASP.NET 사용자 ID를 전달하려면 장소에서이 설정으로
<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.web> 
     <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
     <behaviors> 
      <serviceBehaviors> 
       <behavior> 
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
        <serviceMetadata httpGetEnabled="true" /> 
        <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
        <serviceDebug includeExceptionDetailInFaults="true" /> 
       </behavior> 
      </serviceBehaviors> 
     </behaviors> 
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
     <bindings> 
      <basicHttpBinding> 
       <binding name="MyBindingForWindowsAuth"> 
        <security mode="TransportCredentialOnly"> 
         <transport clientCredentialType="Ntlm" /> 
         <!--<transport clientCredentialType="Windows" />--> 
        </security> 
       </binding> 
      </basicHttpBinding> 
     </bindings> 
     <services> 
      <service name="DataAccessService.Service"> 
       <endpoint address="" binding="basicHttpBinding" bindingConfiguration="MyBindingForWindowsAuth" contract="DataAccessService.IService" /> 
       <endpoint address="mex" binding="basicHttpBinding" bindingConfiguration="MyBindingForWindowsAuth" contract="IMetadataExchange" /> 
      </service> 
     </services> 
    </system.serviceModel> 
    <system.webServer> 
     <modules runAllManagedModulesForAllRequests="true" /> 
     <directoryBrowse enabled="true" /> 
    </system.webServer> 
</configuration> 

, 당신은 3 가지 옵션이 있습니다

명의 도용 사용 :

using (((WindowsIdentity)HttpContext.Current.User.Identity).Impersonate()) 
{ 
    string s = client.GetUserInfo(); 
    retVal = "Wcf User: " + s; 
} 

옵션 3 :
ASP.NET 호출자 ASP.NET 응용 프로그램의 가장

관련 문제