contract operation 'Create' requires Windows identity for automatic impersonation

contract operation 'Create' requires Windows identity for automatic impersonation

Old forum URL: forums.lhotka.net/forums/t/10610.aspx


TSF posted on Friday, August 12, 2011

Trying to implement a WCF service on an app server (IIS7 with WAS / AppFabric) using netTcpBinding endpoints within the intranet with impersonation enabled.  I am getting the following error:

The contract operation 'Create' requires Windows identity for automatic impersonation. A Windows identity that represents the caller is not provided by binding ('NetTcpBinding','http://tempuri.org/') for contract ('IWcfPortal','http://ws.lhotka.net/WcfDataPortal'.

I've looked at the WASHost example project, as well as the Authentication/Windows example project.  But neither shows an example of both Win authentication and TcpBinding at the same time.

Am I missing something in the web.config file on the server that could cause this?  If I set impersonateCallerForAllOperations to false I don't get the exception.  But I would imagine this wouldn't impersonate correctly...is that right?   Thanks.

RockfordLhotka replied on Saturday, August 13, 2011

Are you setting the credentials in the client-side WCF proxy (your WcfProxy subclass)? The Windows authentication example from the ebook should show how that's done.

TSF replied on Monday, August 15, 2011

That must be it.  I assume you're referring to the following code.  That makes sense why impersonation is still working then even though I don't have it in the wcf config settings.  Thanks.

factory.Credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

 

Copyright (c) Marimer LLC