Share via


What Are Some Programming Tips For Using ISAPI on IIS?

OverviewHow Do IFAQDetailsSample

This article discusses programming tips that are specific to an ISAPI extension or filter running on Microsoft Internet Information Server (IIS). If you are running on other Web servers that support ISAPI, they may handle registry keys, memory, and loading of applications differently. Check the documentation for the Web server you are using for more information.

  • Remember that in IIS 1.0, an ISAPI filter is loaded when the service is started and not unloaded until the service stops. An ISAPI server extension is loaded the first time it is invoked and remains in memory until the service is shut down or the memory is needed for another process. Because your DLL will remain in memory for a long time, consider when to allocate resources, when to deallocate resources, and when to connect or disconnect from resources such as a data source.

How Do I Install a New Version of My Filter or Server Extension?

To install a new version of your filter or ISA, you must shut down the service, copy the DLL to the appropriate directory, update the registry if it’s a new filter, and restart the service.

When Is My DLL Loaded or Unloaded?

The registry key HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/W3SVC/Parameters/FilterDLLs controls which filters are loaded when the service starts. It contains a list of filters, including their full paths, separated by commas. To load additional filters, stop the service, add your filter to the registry, and restart the service.

A server extension is loaded when first called by a client.

After the service is started, a filter remains in memory until the computer or the service is shut down. Once loaded, a server extension may also remain in memory until the computer or the service is shut down. You can force reloading of your extension DLL (for example, for debugging purposes) by specifying the registry setting HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/W3SVC/Parameters/CacheExtensions=0. This setting doesn’t take effect until the service is restarted. Note that this setting should be used only while debugging. It has a negative impact on performance, and should never be used on a production server.