开发者

Can I have a WCF call that hits the DB use the creds of the caller?

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 开发者_Go百科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)


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜