Self-Monitoring Applications
The ability to configure application pools so that they'll be recycled when specified events occur is useful, but the ability to build health checks right into an application and, if necessary, have that application request recycling is even more useful. Any IIS 6.0 Internet Server API (ISAPI) extension, including those that you author, can use the new HSE_REQ_REPORT_UNHEALTHY function to invoke application recycling. This capability enables you to build health checks directly into your ISAPI extensions instead of relying exclusively on the server. For more information about this function, go to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/extensions_ssf_hse_req_report_unhealthy.asp.
Active Server Pages (ASP) and ASP.NET in IIS 6.0 are both self-monitoring and will under certain circumstances invoke HSE_REQ_REPORT UNHEALTHY. ASP, for example, monitors how long the ASP script engine takes to return from a processing request. If the time exceeds the ASP Script Timeout setting in the Internet Information Services console, IIS tells the script engine to stop processing. If the script engine fails to return from the stop request, ASP abandons the thread. Internally, ASP keeps track of the number of abandoned threads. If enough threads are abandoned, asp.dll requests recycling.
CPU Affinity
Application pools have another capability that can be useful on multiple-CPU systems: CPU affinity. CPU affinity lets you designate which CPUs to use for your Web applications and can be useful if you're contractually obligated to designate a CPU for a particular client's application. To establish affinity between an application pool and a CPU, you have to set two metabase properties: SMPAffinitized and SMPProcessorAffinityMask.
You use the SMPAffinitized property to turn on affinity for an application pool. In Adsutil, you can use the following command to set this property:
cscript SystemDrive\InetpubAdminScripts\adsutil.vbs
set W3SVC/AppPools/
ApplicationPoolName/
SMPAffinitized TRUE
where ApplicationPoolName is the name of the pool with which you want to establish affinity. When SMPAffinitized is set to the default value of 0 (FALSE, using Adsutil), the application pool can run on any processor.


cscript %SYSTEMROOT%\Inetpub\AdminScripts\adsutil.vbs
set W3SVC/AppPools/LogEventOnRecycle 0xff
activenet April 13, 2004