Running ASP.NET application under elevated privileges

Hopefully there are better ways to run an application in IIS under elevated privileges. For my purposes, what I’ll describe in this post will have to do. Have in mind that having any kind of endpoint exposed to public web under elevated privileges is extremely bad idea. I’m doing this in lab circumstances, on a system whos purpose is to run tests on.

To elevate privileges of a web application, IIS process must be elevated of course. I did not see a way to elevate only single application in my short search.

You would think that impersonating an administrator for a single application would work, or that creating App Pool which runs under an administrator account would work. However, this is not the case.

You’ll have to run to machine.config file in one of following folders (I’ve edited configs of .NET 4, 32 bit and 64 bit):

machineConfigPathsSet userName attribute of <processModel /> element to System.

iisProcessModelAfter you run iisreset your application should be able to do serious damage to the system.