How to profile a web application needing to run as the Network Service account
Published 28 August 2014
Some ASP.NET web applications are designed so that they must always run as the Network Service account. If this is the case, these web applications will almost certainly fail if they are being profiled in ANTS Performance Profiler, because it runs the ASP.NET application pool as the SYSTEM account by default.
It is possible to change the web application so that it will execute as the Network Service account by changing the web.config file for that web application.
To impersonate the Network Service account, use Windows Explorer to navigate to the application's virtual directory, locate the web.config file, and open it in an XML editor. If the web.config file does not exist, create it. The
<identity> tag should be inserted inside the
<system.web> node of the web.config, for example:
<?xml version="1.0"?> <configuration> <system.web> <identity impersonate="true" userName="NT AUTHORITY\NetworkService" password="" /> <compilation debug="true"/> <authentication mode="Windows"/> </system.web> </configuration>
Because the password is managed internally by Windows, the password should be left as an empty string.
Once the web.config is saved, all actions performed by the web application as it is being profiled using ANTS Performance Profiler will be performed by the Network Service account.