Useful commands when working with ASP.NET in IIS

As a developer I quite often need to e.g. restart IIS, stop or start a web application or list all started/stopped web applications or application pools on my machine. Internet Information Service (IIS) comes with a couple of handy command tools that makes it possible to create small scripts that starts or stops applications.

There are several ways to restart a ASP.NET web application hosted by IIS.

  • Make a minor change in web.config simply by adding a space character somewhere in the whitespace. IIS has listeners that keep track of the configuration files and when a change occur the web application pool for that web application will be restarted.
  • Use IIS to restart the web application or application pool used by the web application.
  • Execute the APPCMD RECYCLE APPPOOL “MyAppName”. This command will recycle the app pool used by the web application with the name MyAppName.


The APPCMD single command line tool can be used to administer sites, application pools, web applications, etc. in IIS. The tool can be found in C:\Windows\System32\inetsrv\ on most Windows machines. Read more about APPCMD here.


A site is the web application that usually has been created in IIS Manager. It is possible to add, delete, configure, start, stop and list the sites hosted by IIS on a machine.

List all web sites hosted by IIS on the current machine:

%systemroot%\system32\inetsrv\APPCMD\APPCMD LIST SITE

Stop and start a specific web site.

%systemroot%\system32\inetsrv\APPCMD\APPCMD STOP SITE “MySite”

%systemroot%\system32\inetsrv\APPCMD\APPCMD START SITE “MySite”

Web applications

A web application is hosted by a site and the name of the web application will either be the name of the site or a part of the URL that leads to the web application. It is possible to add, delete, configure and list web applications hosted by sites in IIS. Read more about the difference between sites and web applications in IIS here.

List all web applications hosted by IIS on the current machine:

%systemroot%\system32\inetsrv\APPCMD\APPCMD LIST APP

Application pools

In IIS application pools are being used to prevent one web application from affecting other web applications. If e.g. a web application experiences problems that web application will not bring down the other applications since it will be hosted by a separate application pool (normally). In older versions of IIS a single process took care of all web sites configured on that machine. The new architecture makes it more easy to maintain web applications and prevent them from affecting each other. It is possible to list, configure, add, delete, start, stop and recycle application pools in IIS on the current machine.

List all application pools on the current machine:

%systemroot%\system32\inetsrv\APPCMD\APPCMD LIST APPPOOL

Recycle an application pool on the current machine:

%systemroot%\system32\inetsrv\APPCMD\APPCMD RECYCLE APPPOOL “MyAppPool”

Worker processes

A worker process is used by application pools to execute the requests sent to the sites or web applications.

List all worker processes used by IIS on the current machine:

%systemroot%\system32\inetsrv\APPCMD\APPCMD LIST WP



IISRESET will stop and restart the web server service including all web applications hosted by IIS.

NOTE: IISRESET should be your last resort if you are working on a machine that is not in production. If you execute this command on a machine that is hosting other web applications (even non ASP.NET web applications hosted by IIS) you WILL restart them as well which might not be desirable.

Examples of usage of IISRESET

Restart the webserver on the current machine:




Get status for the Windows services used by IIS:


Stop the Windows services used by IIS:


Start the Windows services used by IIS: