开发者

How do I switch off WCF client impersonation temporaraly to write to, for example, a log file

I am using the following attribute to implement impersonation on my WCF service, as I need to impersonate the client during the entire execution of the method:

    [OperationBehavior(Impersonation = ImpersonationOption.Required)]

The problem is that I don't want the users to have rights on the local file system (as this would be a security hole), so I want my logging library to be able to write to the log file with the rea开发者_StackOverflow社区l credentials that the service is running under. Applying the impersonation just around the necessary code would be tedious and inelegant, as there are many places where it is required. It would be neater if I could temporarily switch it off with a few lines of code in my logging library. What is the simplest way to achieve this?


I've never used impersonation before, but can you just set [OperationBehavior(Impersonation = ImpersonationOption.NotAllowed)] on the logging methods?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜