Starting, stopping and recycling IIS 7.0 Web sites and application pools

As many of you know, IIS 7.0 provides the ability to start and stop Web sites, and application pools.  However, since previous releases, there has been much confusion as to what exactly happens when you do so. This post should clarify this and provide you with the tools you need to execute the tasks correctly.

Update: We recently launched a service that significantly helps you understand, troubleshoot, and improve IIS and ASP.NET web applications. If you regularly troubleshoot IIS errors, manage Windows Servers, or tune ASP.NET performance, definitely check out the demo at

So here we go:

1) Web sites

Stopping – by stopping a Web site, you indicate that the Web site no longer listens for requests on all of its bindings.  This prevents any subsequent requests from being received by your applications in the Web site; new connections to your Web site will fail as if it didnt exist.  However, worker processes serving your web site, applications loaded in those worker processes, and their state remains unaffected.

This makes stopping a Web site a great way to temporarily prevent the Web site from receiving additional requests, without unloading any application state. By starting the Web site, you can very quickly resume request processing.

Starting – by starting a stopped Web site, you instruct it to begin listening for requests again.

Pausing – this doesnt exist anymore. In IIS 7.0, pausing a Web site is the same as stopping it.

Both starting and stopping a Web site does not require writing to configuration.  Instead, these actions send control signals to the W3SVC service. This means that when the server is rebooted, or the W3SVC service is restarted manually or through IISRESET, the sites automatically restart (see next note).

That is, unless the Web site is marked in configuration to not restart automatically.  This is controlled by the serverAutoStart configuration property on the site element.

Final note: when you start or stop the Web site in IIS Manager, it also sets the serverAutoStart property to the corresponding state. When you start or stop the Web site using AppCmd however (or code), you have to manually toggle the serverAutoStart property if you so desire. With that in mind, to stop a Web site and leave it stopped regardless of W3SVC service restarts:

> %windir%system32inetsrvAppCmd Stop Site MySite
%windir%system32inetsrvAppCmd Set Site MySite /serverAutoStart:false

Likewise, to start it and leave it started:

> %windir%system32inetsrvAppCmd Start Site MySite
%windir%system32inetsrvAppCmd Set Site MySite /serverAutoStart:true


2) Application pools

Stopping – by stopping an application pool, you are instructing all IIS worker processes serving this application pool to shut down, and prevent any additional worker processes from being started until the application pool is started again. This initiates a graceful shutdown of the worker processes, with each worker process attempting to drain all of it’s requests and then exit.

If a worker process does not exit within the amount of time specified by the shutdownTimeLimit configuration property in the processModel element of each application pool’s definition (default: 90 sec), WAS will forcefully terminate it (this doesnt happen if a native debugger is attached).

Therefore, stopping an application pool is a disruptive action that causes unload of ASP.NET application domains, FastCGI child processes, and loss of any in-process application state.

After the application pool is stopped, all subsequent requests to all Web applications in the application pool will return 503 Service Unavailable errors untill the application pool is started. The application pool may become automaticaly stopped if the Rapid Failure Protection feature is activated. For more information on troubleshooting this condition, see my earlier post: Troubleshooting 503 / “service unavailable” errors.

Starting – starting an application pool enables IIS worker processes to be created to serve requests in that pool.

Recycling – recycling an application pool causes all currently running IIS worker processes in that application pool to be gracefully shutdown, but unlike stopping the pool, new IIS worker processes can be started on demand to handle subsequent requests.

Recycling an application pool is a good way to cause the reset of application state and any configuration cached by the IIS worker processes that does not get automatically refreshed (mostly global registry keys), without disrupting the operation of the server. This makes recycling the application pool a great alternative to an IISRESET in most cases.

(NOTE: You DO NOT need to recycle IIS 7.0 application pools or perform an IISRESET when you change configuration.  All IIS 7.0 features automatically pick up configuration changes (and some changes may trigger IIS worker process to recycle automatically, such as a change to the globalModules configuration section). However, recycling may be necessary when you change registry keys.)

Recycling an application pool SHOULD NOT cause any request errors.  The only time you may see errors is if your applications require a long warmup time to restore their state and this causes requests to either time out, or your server to become overloaded and reject requests. This can typically be mitigated by adjusting application pool queue sizes and queue timeouts.

Just like starting and stopping sites, starting and stopping application pools does not change configuration, but instead sends a control signal to the WAS service. Therefore, when the server is rebooted or the service restarts, application pools will typically also start again unless they are configured not to do this through the autoStart configuration property.

To stop an application pool and leave it stopped:

> %windir%system32inetsrvAppCmd Stop Apppool MyAppPool
%windir%system32inetsrvAppCmd Set Apppool MyAppPool /autoStart:false

Likewise, to start it and leave it started:

> %windir%system32inetsrvAppCmd Start Apppool MyAppPool
%windir%system32inetsrvAppCmd Set Apppool MyAppPool /autoStart:true

This should help clarify things. As always, shout if you got more questions.





  1. Anonymous

    Is there any way to force a worker process to be created immediately when the application pool starts up? If I want to use a WAS hosted Workflow foundation application which serves long running workflows, the need for an external request so that WAS starts a worker process is kind of a spoiler.


  2. Mike Volodarsky


    There is not unfortunately. WAS and http.sys use an on-demand start architecture where a request (message) is needed to create a worker process.

    However, you can keep your worker process running by controlling the idle timeout of the application pool. The process will have to recycle eventually, but you can significantly minimize the frequency of this event by keeping the process from exiting during idle times.



  3. Anonymous

    I’m examining a situation when the application pool is stopped while there is an open request. Even though my request handler is still processing the srf file, IIS 7.0 sends HTTP code 503 (Service unavailable) to my client.

    Then it waits for the handler to terminate and calls TerminateExtension method of the ISAPI extension. However, neither it allows the handler to send a response, nor the handler can open connection to the SQL server.

    This behavior contradicts the content of the article. Am I missing some configuration setting?

    • Francisco Javier

      When AppPool’s timeout is reached (Shutdown time Limit) the request is terminated (killed), then you can adjust that value, it is 90 secons by default.

  4. Anonymous

    I upgraded to Vista Ultimate and IIS no longer works and I can not start the service because w3svc was disabled. Please point me in a direction

  5. Anonymous

    Does IIS 7.0 supports all counters that are already present in IIS 6.0?

    I have installed IIS 7.0 on Windows server 2008 EE but Perfmon doesn’t shows counters related to NNTP service.

    So please let me know if I am missing some configuration for the same.

    Also, during investigation of IIS 7.0 I have just got links for new perfmon objects which are related to monitoring worker processes health, but not got information on about all IIS 7.0 counter reference ?

    Do we need to consider HTTP Service related counters for monitoring IIS 7.0?

    Any help would be appreciated?

  6. Anonymous

    When in my office windows server 2008 when started local website then i browesing the website then automatically W3SVC is stop please solve this sollution

  7. Mike Volodarsky

    Hi Sandip,

    > sc query w3svc

    Is your w3svc service running?

    > %windir%system32inetsrvappcmd list site

    Is your site stopped?

    Check your System event log to see why your site or your w3svc service is being stopped.



  8. Anonymous


    Question, we run on a shared server with a fixed app idle time of 20 minutes. We are not allowed to change this setting, but as a startup we often have more then 20 minutes between visitors.

    This causes a the application to be recompiled if you visit more then 20 minutes after the previous and this recompile causes response times to drop to 30 sec plus.

    What would be the best way to work around this issue?

  9. Mike Volodarsky

    Hi Bas,

    There shouldnt be a recompile, but the slow start can be due to the application startup activities (i.e. if you are caching data on App_Start).

    Since you cannot change the idle timeout, the best/only thing to do is to write a script that makes periodic requests to a url on your server (lets say, 1 every 10 minutes?). You may even be able to make this request happen from inside your own application on a timer, although this wont work whenever the application pool is recycled externally/due to config changes – so I recommend doing this from another machine.



  10. Anonymous

    Hi Mike, i've tried your method but still having a problem. I could not start my site at all. When i click to start the site, a error window pop-up say : "Access is denied. (Exception from HRESULT:0x80070005 (E_ACCESSDENIED))". Please help me solve this problem.

    Thank you.

  11. Anonymous


    can anyone please help me that i need to write a script when the application goes down i need to recyle the application pools in IIS.

  12. Anonymous

    We have a problem where our server (http/ftp) is serving hundred of files that get updated mutliple times per day. Our clients pull this files to update the client side application. We are seeing that some files are being locked when we attempt to update (overwrite) them and causes corrupted sets of files where older ones are not updated because they are locked and cannot be overwritten.

  13. Anonymous

    What is the correct step to be taken while deploying a new version of application DLL to IIS 7.0. Should we Stop Website , copy dll & then start website or Should we stop app pool, copy dll & start app pool or should we just recycle app pool?. I believe we would not be able to overwrite a DLL when its loaded in the memory until the app pool is stopped? Is this correct

  14. Anonymous

    Hi Mike,

    I have windows server 2008 R2, my IIS version is 7.5, My website stays on for some time and then later on it shuts down and when i look at the services i see that windows world wide web publishing is disabled 🙁 Can you please tell me what is causing this ?

  15. Pushkar

    Hi Mike,

    Thanks for helpful post.

    I need your help in below problem.

    When i try to start stopped ASP.Net Web Site Application pool, it throws following error.

    “The service cannot accept control messages at this time. (Exception from HRESULT: 0x80070425)”

    But when i try the same procedure after 10 mins it works fine.

    My system is Windows 7 with IIS 7.5.7600 installed.

  16. Ravi

    Could you share some info that why we are stopping the Application pool and websites while deployment. Is it necessary to stop IIS for small fixes. Please

  17. Michael Panayiotou

    Hi Mike
    Very useful post even after so many years!
    – Can you provide some details as to what happens when an Application is recycled ? (i.e. AppDomain).
    – Are the Application recycling settings (e.g. shutdownTimeLimit) taken from those of the Application Pool ?

  18. Brian

    After a restart of the server the application pool did not start automatically even though the check in IIS for the app pool is checked. Once started manually everything was ok.
    What could have caused this behavior. Password is excluded due to the fact that it worked manually. Load User Profile is on False.

  19. Prachi Singh

    Application with .Net framework 4.5 and MVC is deployed in the server.when ever security patchs has been done in the server.Application gets stop.Then we need to do IIS reset and browser the site via IIS then it will be accessible.This is quite wired since IIS should automatically restart the application.Kindly help to fix.

Leave a Reply

Your email address will not be published. Required fields are marked *