Geeks With Blogs
Yossi Dahan

Mostly a reminder for myself, but hopefully useful to somebody else -

Often it is important to specify a specific user for a service to run as; it appears the setup is completely different when using IIS 5.1 or 6 (and higher).

 

When using IIS 5.1

  • Set the anonymous user on the virtual directory to the user you want to run as.
  • Disable any other authentication method on the vdir
  • In the web.config turn impersonation ON (<identity impersonate="true" /> under System.web.)
  • Under System.serviceModel add  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
  • To the service class add  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

 

When using IIS 6.0

  • In the web.config turn impersonation OFF(<identity impersonate="false" /> under System.web.)
  • Set the required identity in the app pool your virtual directory runs under.

 

(which one do you prefer? ;-))

Posted on Sunday, January 25, 2009 8:08 AM WCF | Back to top


Comments on this post: Specifying the user for a service to run as

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Yossi Dahan | Powered by: GeeksWithBlogs.net