11

How do I restart the IIS application pools from command line, like I can do from IIS Manager, without restarting IIS itself with iisreset and having to wait up to a minute for it to come back online?

2 Answers 2

8

You can use the recycle command as mentioned in Recycle an Application Pool on Demand (IIS 7) or use combination of Stop/Start mentioned at Start or Stop an Application Pool (IIS 7). Both have separate sections for command line.

8

First your terminal should be elevated to have admin permissions.

Assuming that the inetsrv folder is not mapped on your system, you can do the following:

"%windir%\system32\inetsrv\appcmd" recycle APPPOOL "MyAppPoolName"

This will recycle the application pool with the name MyAppPoolName so long as it isn't already stopped. If it is, you'll get the error message ERROR ( message:Application pool "MyAppPoolName" is not started. ).

There's also the good old-fashioned stop-then-start:

"%windir%\system32\inetsrv\appcmd" stop APPPOOL "MyAppPoolName"
"%windir%\system32\inetsrv\appcmd" start APPPOOL "MyAppPoolName"

Again, that will error if you ask it to stop and it's already stopped.

If you want a full list of the supported commands on an application pool, you can run the following:

%windir%\system32\inetsrv\appcmd APPPOOL /?

For reference, this will output the following:

Supported commands:

  list      List application pools
  set       Configure application pool
  add       Add new application pool
  delete    Delete application pool
  start     Start application pool
  stop      Stop application pool
  recycle   Recycle application pool

(To get help for each command use /?, e.g. 'appcmd.exe add site /?'.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .