Checklist for multi hop delegation in ASP.NET and WCF using wsHttpBinding.


If you need to access resources by using the authenticated caller's identity or by using a specific Windows identity other than the process identity, you can configure your ASP.NET application to use impersonation. Moreover, delegation allows you to use an impersonation token to access multiple network resources, such as the following scenario:


We have a sample project to achieve this requirement. The sample code can be downloaded here:

Here is checklist for similar multi hop delegation problems:

1. Make sure the host server and account is trusted for Delegation.



2. Enable impersonation for ASP.NET web application. Enabled Anonymous Authentication and Windows Authentication.

3. Add the following attribute to each method in the WCF service that needs impersonation/delegation.

[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]

4. Service side:

a. Use wsHttpBinding with Windows credential.


    <binding name="wsHttpBinding">

<security mode="Message">

         <message clientCredentialType="Windows" />





b. Adding impersonateCallerForAllOperations="true" in serviceBehaviors.



    <behavior name="ServiceBehavior">

      <serviceMetadata httpGetEnabled="true" />

      <serviceDebug includeExceptionDetailInFaults="false" />

<serviceAuthorization impersonateCallerForAllOperations="true" />




c. Adding SPN for service endpoint.


<service behaviorConfiguration="ServiceBehavior" name="WCF_A.ServiceA">

<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding"



<servicePrincipalName value="HOST/WS1" />

<dns value="localhost" />



<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />



5. Client side

a. Add allowNtlm="false" allowedImpersonationLevel="Delegation" for ClientCreentials elements.


        <behavior name="WCFAClientBehavior">


<windows allowNtlm="false" allowedImpersonationLevel="Delegation"/>




b. To enable the double hop, the client calling the WCF service needs to set the impersonation level of the WCF service to Delegate.  This is performed with the following code:

service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;


More information:





Ray Wang from DSI team