I do not know how to do this using the command line, but here are the steps through the graphical interface.
- Open IIS Manager
- Expand server
- Expand Sites
- Go to your application and select it
- Click "Basic Settings ..." in the actions on the right.
- Click "Connect as ..."
In this window you can change the user.
Note that there are two forms of impersonation that cause confusion. Initiating an application pool causes the application to start in the context of the user. Connect as forces the application pool to use the user to access the resource on disk, otherwise it does not actually run in the context of the user.
Also note that if you use anonymous authentication, the “Authenticated User” in the “Connect As” field is the anonymous user defined in “Authentication”.
source share