Freigeben über


Why IIS6 Application Pool Recycle Events are not logged

Question:

Hi,

I would like IIS to log application pool recycle events. I followed this article

https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/87892589-4eda-4003-b4ac-3879eac4bf48.mspx

restarted IIS and even rebooted the machine then recycled the app pool that I want to log events on, but the recycle events aren't being written to the system log or any other log that I can see. Anyone have any ideas what I might be doing wrong?

Cheers,

Answer:

The reason you are not seeing recycle events written to the event log is because no worker processes actually recycled when you demand-recycled the application pool. In other words, the IIS Manager UI always gives you the option to trigger "Recycle" of the application pool, but if no worker processes are currently running and servicing the application pool, no worker processes actually recycle and hence no event log gets written.

For efficiency and reliability reasons, IIS6 demand-starts worker processes for application pools. What this means is that you can define 100 applications, each with its own application pool, but until a request is made to that application, no worker process (and hence no system resources) are consumed. Default configuration also has "idle timeout" where the worker process terminates itself and release system resources when it has not handled any requests for the specified amount of time. Both demand-start and idle-timeout allow IIS6 to naturally optimize system resources towards active applications.

What this means is that when you restarted IIS or rebooted the system, no one has made any requests to your server to demand-start any worker processes... so none are running and you obviously cannot demand recycle non-existent worker processes...

Thus, to see your configuration work, simply first make a request to a URL serviced by the application pool you plan to recycle, and then do the demand-recycle of the application pool in the IIS Manager UI. You should now see an event log entry in the System event log.

And, this feature works dynamically as soon as you set the metabase property - no IIS restart or server reboot required.

//David

Comments

  • Anonymous
    April 30, 2008
    We have a big difference of opinion on the App pool recycle issue. The question is if I do an IISRESET does that recycle all App polls or is there  a situation where an IISRESET will not recycle app pools

  • Anonymous
    April 30, 2008
    ppateel - IISRESET forcibly restarts all of IIS, killing its processes as necessary, so it does more than just recycle all Application Pools. //David

  • Anonymous
    April 30, 2008
    The comment has been removed

  • Anonymous
    May 01, 2008
    Prahalad - actually, if Orphaning is enabled (not enabled by default), orphaned w3wp.exe (which never handle any more requests) will remain after IISRESET. However, Application Pool Recycle won't do anything, either. Orphaned w3wp.exe are just that -- orphaned -- and no longer under control/watch of IIS and hence can hang around. //David

  • Anonymous
    May 02, 2008
    David. Thanks for your clarification.

  • Anonymous
    September 09, 2008
    The comment has been removed

  • Anonymous
    June 02, 2009
    Hi, I am running Windows Server 2003 with default settings and have some application pools in isolation mode. The server works well except the fact I have some unexplained worker process recycles. (BTW, I have the app pools set to recycle at a specific time during the night). So I changed the LogEventOnRecycle to 255 but do not see any such event logged. I am manually recycling the pool (it is indeed recycling as I see at the task manager’s processes tab). I also tried clearing the Application Event log. Any idea why events are not logged? Thanks, Edmund

  • Anonymous
    August 20, 2012
    D'oh! I've been trying to see app pool recycle logging show up to no avail. Your explanation nailed it. Thank you!