IIS6 - Caching of UNC content: Reverting back to the Last-Modified Time method

As explained in the white paper on IIS and remote storage, IIS 6.0 offers two methods of file caching which need to be considered when configuring your server to host remote content. The two methods are on-demand polling based (using the content file’s Last-Modified Timestamp), and change notification based (using the File System Change Notifications). The white paper does an excellent job explaining in detail what these two methods entail, specifically in the Optimizing IIS Caching for Remote Content section.

Your IIS server may have a file system that is not reliable in providing change notifications to IIS; if so, you should revert back to using the polling method referred to as Last-Modified Time method. One way to tell that the Last-Modified Time method is better for your web application environment than the Change Notification method is if you see stale content being served by IIS when the actual content files have been changed, and you have the Change Notification method enabled.

Last-Modified Time is the default caching method. However, if you have disabled it and need to revert back to the Last-Modified Time method, follow these steps:

1) Set the registry property DoDirMonitoringForUNC, a DWORD value located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters, to 0.

2) Set the registry property EnableChangeNotificationForUNC, a DWORD value located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ASP\Parameters, to 0.

After enabling the Last-Modified Time method, you may need to change how often IIS checks the Last-Modified Time property of the content files. IIS will by default check the files every five seconds; this may be too short or too long for your site. You can configure the sampling intervals for static and ASP content with the following registry keys, which are not present by default:

1) For static content like HTML or STM files, set the registry property FileAttributeCheckThreshold, a DWORD value located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Inetinfo\Parameters. Give it a value in seconds, between 0 and 4,294,967.

2) For dynamic ASP content, set the registry property FileMonitoringTimeoutSeconds, a DWORD value located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ASP\Parameters. Give it a value in seconds, between 0 and 4,294,967.