October 3, 2024

Well, I faced a similar problem in the recent past and also found this problem for many, so I decided to write an article for consolidating the same. First of all, there is a difference between Application Pool and an Application  Domain which is as follows

Application Pool : An Internet Information Services (IIS) application pool is a grouping of URLs that is routed to one or more worker processes. Because application pools define a set of Web applications that share one or more worker processes, they provide a convenient way to administer a set of Web sites and applications and their corresponding worker processes. Process boundaries separate each worker process; therefore, a Web site or application in one application pool will not be affected by application problems in other application pools. Application pools significantly increase both the reliability and manageability of a Web infrastructure. For more details, refer to the following Link.

Application Domain : A boundary that the common language runtime establishes around objects created within the same application scope (that is, anywhere along the sequence of object activations beginning with the application entry point). Application domains help isolate objects created in one application from those created in other applications so that run-time behavior is predictable. Multiple application domains can exist in a single process. For more details, refer to the following Link.

So the problem faced by majority of us is as follows:

When does Application Pool Restart?

There are two types of reasons when an application pool recycles.

  •   Scheduled Application Pool Recycling
  •  Abrupt Application Pool Recycling
Scheduled Application Pool Recycling : 
This is due to the settings specified in the Recycling Tab in  Application Pool’s Properties Dialog Box.
The conditions for which application pool may restart is as follows:
1. Worker Process remains idle for  a specified amount of time.
2. Worker Process has served a specific number of requests.
3. Recycling of application pool at scheduled time/s.
4.  When the virtual memory is occupied by a Worker Process is more than the specified threshold value.
5. When the memory used by a Worker Process is more than the specified threshold value.
This can be seen from the below screen shots :
Application Pool Properties in IIS 6
Application Pool Properties in IIS 6
Application Pool Properties in IIS 7
Application Pool Properties in IIS 7

Some More Information:

To configure the Scheduled Application Pool recycling please refer the following links: For IIS 6 and For IIS 7 Now in case you wan to stop the Scheduled Application pool recycling, you can specify it in the settings of Application Pool.

But it is highly recommended by Microsoft not to do so.

Abrupt Application Pool Recycling There are a multiple reasons for this.

They are as follows:

1. Any modifications in the Application’s BIN Directory

2. Making changes in any Configuration File/s, like Web.config or others ( if you have any specific config file in your application say in a directory called App_Config).

3. Making modifications in the Source code files in APP_CODE Directory. This maybe change in any Source code files, or adding or deleting files from this directory.

4. Making changes in the Global.asax file

5. Making Changes in the Machine.config file.

6. Making any modifications in the Web Application’s Root Directory. This means creating files/subdirectories on the fly can lead to application pool recycling.

7. Modifications for references of Web Services of App_WebReferences directory.

8. Modifying the Security Settings of any directory in the Root directory. (Like specifying read security rights for everyone or any other specific user or user group.)

This was just a brief info on IIS Application Pool Restart.

For more details, please refer to the references:

1.http://support.microsoft.com/kb/332088

2.http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1eee28e2-b319-4b4e-8267-a8c0aa0dcf36.mspx?mfr=true

3. http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/24e3c22e-79a9-4f07-a407-dbd0e7f35432.mspx?mfr=true

4. http://blogs.msdn.com/b/johan/archive/2007/05/16/common-reasons-why-your-application-pool-may-unexpectedly-recycle.aspx

5. http://blogs.msdn.com/b/david.wang/archive/2006/01/26/thoughts-on-application-pool-recycling-and-application-availability.aspx

6. http://forums.iis.net/t/1153736.aspx

Hope this Helps!

7 thoughts on “Application Pool Restarts

  1. Hi! I simply would like to give you a huge thumbs up for your great info you have got here on this post.

    I am returning to your website for more soon.

  2. we are having issues with memory leak in sitecore site until we fix the root cause, we are recycling app pool every week. does recycling app pool every week causes any issue.

    1. Hi Venki,

      No weekly recycling wont cause any issue in case your solution has memory leaks.
      Infact, its better that you recycle it.
      Also, to dig in more into the issue of memory leak, and finding effective solution to it, I would suggest you to refer to the following link:
      http://www.dotnetfunda.com/articles/article625-best-practices-no-5–detecting-net-application-memory-leaks-.aspx

      Let me know if this helps, or I can be of some help to you!

      Regards,
      Varun Shringarpure

Leave a Reply

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