surrealization.com

Occasionally I come up with something worthwhile

Getting Notified When An IIS AppPool Recycles

Wednesday, May 07 2008

IIS Application Pool recycling in IIS 6 is a crutch for poorly performing code and is frequently misunderstood and overused. However, if you do have a need to use it and want to minimize the hit of your applications in that AppPool spinning up again on the next request, you can use the following code to determine when it recycles. First, you need to configure IIS to enable reporting AppPool recycle events. This is off by default. This can easily be done using WMI and C#: using System; using System.Collections.Generic; using System.DirectoryServices; using System.Linq; using System.Text; namespace...