Useful Tech Tips, Tutorials and guides

IIS7 restart an Web site / recycle app pool

IIS7 how to restart an individual Web site or recycle app pool.

When you use the iisreset command in IIS 7.0, the IIS Admin Service, the Windows Process Activation Service (WAS), and the World Wide Web Publishing Service (WWW Service) are stopped and restarted. You should avoid using iisreset unless absolutely necessary, because the Web server shuts down all applications that depend on these three services until the services successfully restart. This means that you lose existing state in your applications, your Web sites and applications become unavailable, and you risk unpredictable results by stopping processes before they finish.
 
Instead, you can restart an individual Web site or recycle an application pool that is causing problems. To do this by using IIS Manager, follow these steps:
  • To restart an individual Web site, in the Connections pane, expand the Web site node. In the tree, click the site that you want to restart, and in the Actions pane, click Restart.
  • To recycle an application pool, in the Connections pane, click the Application Pools node. On the Application Pools page, select the application pool that you want to recycle, and in the Actions pane, click Recycle.
To do this by using appcmd, follow these steps:
 
  • Click Start. In the Start Search box, type cmd and then press ENTER.
  • At the command prompt, type cd %windir%system32inetsrv and then press ENTER.
  • To restart an individual Web site, type appcmd stop site “site_name where site_name is the name of the Web site that you want to restart. Then type appcmd start site “site_name.
  • To recycle an application pool, type appcmd recycle apppool “apppool_name where apppool_name is the name of the application pool that you want to recycle.

If you decide to use iisreset, you can include the /noforce parameter to prevent the services from being forcefully restarted if they cannot do so gracefully, and the /timeout parameter to specify a number of seconds to wait before the services are restarted. This may help prevent problems that can occur when processes are stopped before they finish.