Add an ISAPI Filter (IIS 7)
Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista
Add an ISAPI filter when you want to enhance Web server functionality. For example, you might have an ISAPI filter that captures information about HTTP requests and saves the information to a database.
Note
Although IIS 7 supports ISAPI filters, we recommend that you extend Web server functionality by using modules instead of by using ISAPI filters. For more information, see Configuring Modules in IIS 7.
You can add an ISAPI filters at the server level and the site level. If you add the ISAPI filter at the server level, the filter will intercept all requests made to the server. If you add the ISAPI filter to a specific site, the filter will intercept all requests made to that site.
Prerequisites
For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see ISAPI Filters Feature Requirements (IIS 7).
Exceptions to feature requirements
- None
To add an ISAPI Filter
You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing the configuration files directly, or by writing WMI scripts.
User Interface
To use the UI
Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).
In Features View, on the server or siteHome page, double-click ISAPI Filters.
On the ISAPI Filters page, in the Actions pane, click Add.
In the Add ISAPI Filter dialog box:
In the Filter name box, type a friendly name for the ISAPI filter.
In the Executable box, type the file system path of the location of ISAPI filter file, or click the browse button (...) to navigate to the folder that contains the ISAPI filter file.
Click OK.
Command Line
To add an ISAPI filter, use the following syntax:
appcmd set config /section:isapiFilters /+[name='string',path='string',enabled='true|false',enableCache='true|false',preCondition='string']
The variable namestring is the name of the ISAPI filter that you want to add. The variable pathstring is the physical path of the ISAPI filter's .dll file.
Additionally, you can specify values for the optional attributes: enabled, enableCache, and preCondition. By default, the enabled attribute is true, the enableCache attribute is false, and there are no preconditions. If you want to disable the ISAPI filter, specify false for the enabled attribute. If your ISAPI filter is cache friendly to HTTP.sys, which means that the filter does not conditionally reroute URLs for /default.htm to either /default-1.htm or /default-2.htm, you can specify true for the enableCache attribute. Finally, you can include preconditions if your ISAPI filter has certain conditions under which it should run, such as the bitness32 precondition, which specifies that an ISAPI filter should run only in 32-bit worker processes.
For example, to add an ISAPI filter named ResponseFilter, with a .dll file in the .NET Framework version 2.0 directory and a precondition to run only in 32-bit worker processes, type the following at the command prompt, and then press ENTER:
appcmd set config /section:isapiFilters /+[name='ResponseFilter',path='%windir%\Microsoft.NET\Framework\v2.0.50727\responseFilter.dll',preCondition='bitness32']
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).
Configuration
The procedure in this topic affects the following configuration elements:
<isapiFilters>
For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.
WMI
Use the following WMI classes, methods, or properties to perform this procedure:
- IsapiFiltersSection.Filters.Add method
For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7. For more information about the classes, methods, or properties associated with this procedure, see the IIS WMI Provider Reference on the MSDN site.