I need the application pool in my Azure web role to run under a specific user. There's this code that restarts the application pool - I run it from OnStart()
in my RoleEntryPoint
descendant and it works fine.
However restarting is not so good - the pool first starts under the default user (Network service), is then stopped and started again under the right user. First, it takes some time and I'd like my web role to start as fast as possible. Second, when I do that on Compute Emulator the debugger will detach from the IIS worker process once the application pool stops (and the process terminates) and I have to manually reattach the debugger to the newly started IIS worker process.
Is there a way to have the web role application pool started under the right user from the very beginning?