views:

37

answers:

1

I have read a lot about impersonation, and I have tried a ton of tags in my config file. I have tried [OperationBehavior(Impersonation = ImpersonationOption.Required)] on my method that hits the database.

None of it works. I get a wide variety of error messages depending on how my config is setup.

Can anyone lay out for me what C# and configuration (ie bindings, behaviors, endpoints settings) is needed to get the following scenario to work:

  • I call a WCF method via WCFTestClient.
  • The WCF Method is hosted in IIS (running under an IIS user that is not a valid user in the DB).
  • That method sees who the caller is and passes those credentials on to the call to the database
  • The Call to the database is in a different project (a class library) and uses Linq-to-sql
  • The database performs the action as if the caller of the WCF service had done it.

If anyone has clarified this mystery please share the details with me.

Thanks!

(NOTE: I am developing in Visual Studio 2010 Ultimate and hosting in IIS 7)

+1  A: 

There is a nice walkthrough of how to set up impersonation in WCF here. You may be missing the servicebehavior setting?

Steve Townsend