2011-07-01 2 views
4

WSHttpBinding 및 Windows 인증을 사용하는 간단한 WCF 서비스가 있습니다. 이 서비스에 대한 모든 메소드 호출시 서버가 클라이언트의 신원을 가장하도록합니다.WCF 구성을 통한 가장

나는 WCF Service Impersonation에 주어진 조언을 시도했지만 만족스런 결과를 얻지 못했습니다. 나는 WCF 서비스에 대한 방문 페이지로 이동하려고하면, 나는 오류를 참조하십시오에

The contract operation 'GetAdvice' requires Windows identity for automatic impersonation. A Windows identity that represents the caller is not provided by binding ('WSHttpBinding',' http://tempuri.org/ ') for contract ('IMagicEightBallService',' http://tempuri.org/ '.

어떤 아이디어 걸 말하려고이 오류의?

전체 솔루션은 ftp://petio.org/2011/07/01/MagicEightBall/에서 검색하거나 http://petio.org/2011/07/01/MagicEightBall.zip에서 다운로드 할 수 있습니다. 나는 그 프로젝트를 로컬 IIS 폴더에 게시하고 http://localhost/MagicEightBall/MagicEightBallService.svc에있는 서비스에 액세스하고 있습니다.

감사합니다.

UPDATE :

내 서비스의 web.config :

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 

    <system.serviceModel> 

    <services> 
     <service name="Petio.MagicEightBall.MagicEightBallService" behaviorConfiguration="MagicEightBallServiceBehavior"> 

     <endpoint name="WSHttpBinding_WindowsSecurity_IMagicEightBallService" 
        address="http://localhost/MagicEightBall/MagicEightBallService.svc" 
        binding="wsHttpBinding" 
        contract="Petio.MagicEightBall.IMagicEightBallService" /> 

     <endpoint address="mex" 
        binding="mexHttpsBinding" 
        contract="IMetadataExchange" /> 
     </service> 
    </services> 

    <behaviors> 
     <serviceBehaviors> 
     <behavior name="MagicEightBallServiceBehavior"> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
      <serviceAuthorization impersonateCallerForAllOperations="true" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 

    </system.serviceModel> 
</configuration> 

내 서비스 코드 :

public class MagicEightBallService : IMagicEightBallService 
{ 
    [OperationBehavior(Impersonation=ImpersonationOption.Required)] 
    public string GetAdvice() 
    { 
     MagicEightBall ball = new MagicEightBall(); 
     return ball.GetAdvice(); 
    } 
} 

답변

3

무엇 재현 코드를 간단한 대에 모든 문제를 최소화 대해 어떤을 간단히 여기에 표시 할 수 있습니까? 누구도 프로젝트 전체를 다운로드하고 검토하는 데 관심이 없습니다. 또한 나중에 참조 할 수 있도록 관련 코드가 여기에 있어야합니다.

내가 프로젝트의 당신의 단지 구성 및 클라이언트 코드를 확인하고 내가이 차단 문제 참조 : 당신은 당신이 Windows 인증 만 바인딩을 사용해야합니다 구성에서 가장을 적용하려면

  • 을 - 엔드 포인트는 이상 노출 HTTPS는 인증이 없습니다.
  • WCF의 가장은 또한 클라이언트가 자신의 ID를 가장해서 서비스의 구성을 설정하는 것만으로는 충분하지 않을 것을 요구합니다.

Here 가장 및 필요한/가능한 모든 설정에 대한 기사가 있습니다.

+0

감사합니다. 나는 단지 가장 조합 구성 옵션을 필요로했습니다. –

+0

향후 다른 서비스 : 를 사용하는 경우 [OperationBehavior (...)]를 사용하여 서비스의 모든 메소드를 장식해야합니다. impersonateCallerForAllOperations가 자동으로이 작업을 수행한다고 잘못 가정하여 혼란을 일으켰습니다. –

+0

또한 로 인해 내 물건이 손상되었습니다. 나는 그것이 무엇인지 정확하게 알지 못하고 거기에 넣었으나 (마지막 코멘트 이외에) 그것을 제거하면 내 앱이 고쳐졌다. –

관련 문제