IIS 6 Administration

An important thing to configure for ISAPI extensions running on your server, whether these are default extensions included with IIS (like asp.dll, the ASP script engine) or custom DLLs you develop or obtain from a third-party vendor (like Active State’s perlis.dll Perl script engine), is enabling caching of ISAPI extensions. However, since this is a performance issue, we’ll talk about it later in Chapter 12, when we discuss IIS performance tuning and monitoring.

The other issue with ISAPI extensions is that before they will work on IIS they need to be enabled using the Web Service Extensions (WSE) node of IIS Manager (refer back to Figure 8-2). If your ISAPI extension isn’t listed on the WSE screen, you can either add it manually or allow all ISAPI extensions to execute—I’ll discuss the difference in Chapter 10.

ISAPI Filters

ISAPI filters are another matter. You can install and configure these using the ISAPI Filters tab on the properties sheet for either the Web Sites node (global filters) or for individual websites (site filters). For example, if you have enabled ASP.NET using WSE, an ISAPI filter called aspnet_filter.dll is listed on the ISAPI Filters tab of the Web Sites Properties sheet (see Figure 8-13). Note that this filter does not appear on the ISAPI Filters tab of any individual website properties sheet—filters defined at the global level appear only on the Web Sites Properties sheet.

Figure 8-13: Installing and configuring ISAPI filters

Using the interface on this tab, you can add, remove, edit, and change the processing order of ISAPI filters on your site or server. If you have multiple ISAPI filters installed and registered for the same web server event, filters with high priority are called before filters with low priority, and filters with the same priority are processed in sequence with global filters executing before site filters.

Note 

When you add, remove, or modify a global filter, you must restart IIS before it will load and run (see Chapter 5 on how to restart IIS). This extra step is not required for site filters, however, which are automatically loaded when you add them to the site properties.

Wildcard Application Mappings

Instead of using ISAPI filters to preprocess HTTP requests, IIS 6 allows ISAPI extensions to perform this task by configuring wildcard application mappings. This is advantageous over using ISAPI filters for several reasons:

The alternative to using ISAPI filters is to create an ISAPI extension that performs the same job and then create a wildcard mapping so that every HTTP GET request for a file, regardless of the file’s extension, is first processed by the ISAPI extension before being sent to the script engine or interpreter that executes the application running on the site.

Adding Wildcard Mappings

To add a wildcard application mapping to a site, server, or virtual directory, perform the following steps:

  1. Open the properties sheet—for a virtual directory within a site, a specific website, or the global Web Sites node in IIS Manager—and switch to the Virtual Directory or Home Directory tab as appropriate.

  2. Click the Configuration button to open the Application Configuration screen, select the Mappings tab, and click Insert to open the Add/Edit Application Extension Mapping dialog box.

  3. Type the path to the ISAPI filter you want to assign a wildcard mapping to, or browse to locate the file on your hard drive, and click OK to verify the file exists. You’ll return to the Mappings tab.

  4. If you have several wildcard mappings created, you can move them up or down in the list to put their execution in the order you prefer.

    Tip 

    If the Configuration button on the Virtual Directory tab is dimmed out, it means your virtual directory is not an application starting point and therefore can’t be configured. Go instead to the properties sheet for the parent website of the directory and make the changes there.

Категории