Configuring modules
For some people, IIS is a black box: The requests come in, the server locates the desired resource, and the response goes back to the caller - nothing could be simpler. Of course, it isn't actually that simple. Various requests have differing needs. To service each of these requests, the server must have software that understands the request and provides the desired response. That's the purpose of response modules. IIS calls a response module based on the user's request. The response module handles the details.
To display the response modules for a Web site, select the Web site in the Connections pane and double-click the Modules icon in Features view. You see the standard list of response modules, along with any special response modules you installed. The following sections describe how to perform various response module management tasks.
Adding a native module
Native code modules use older languages that produce an executable that IIS can read directly. The following steps describe how to add a native module that comes with IIS:
- Click Configure Native Modules.
You see the Configure Native Module dialog box. The modules you see are the additional modules that come with IIS. - Place a check next to any of these modules as needed to assist in processing data on your server.
- Click OK.
IIS installs the module.
Adding a managed module
Managed modules rely on code that a developer creates using the .NET Framework. Whenever a caller requests a resource that this module can provide, IIS transmits the request through the Common Language Runtime (CLR, pronounced "clear"), which in turn compiles the module and starts it. After this initial communication, the managed module works much like the native code version. Consequently, you can obtain all the benefits of working with a managed module without incurring a significant performance penalty. The following steps describe how to add a managed module:
- Click Add Managed Module in the Actions pane.
You see the Add Managed Module dialog box. - Type a name for the managed module in the Name field.
- Choose a managed module type from the Type field.
IIS provides a number of type entries that don't already appear in the modules list. For example, you can add additional support for mobile devices by adding the appropriate managed module. - (Optional) Check the Invoke Only for Requests to ASP.NET Applications or Managed Handlers.
You can choose to let the module service only ASP.NET applications or managed handlers. This choice makes sense when your server runs mostly ASP.NET applications and the module won't work with other content. Checking this option can save system resources and improve performance slightly. - Click OK. IIS installs the managed module.
Editing module settings
You may eventually need to edit one of the module entries you created. To perform this task, highlight the entry in the list and click Edit in the Actions pane. IIS displays the appropriate native code or managed module dialog box. Make any required changes and click OK. The "Adding a native module" and "Adding a managed module" sections of this tutorial provide details about the dialog boxes.
Never edit a module entry that Microsoft provides with IIS unless told to do so by product support. Changing a module entry can have unexpected results and may even cause a server crash (or worse). Always record edits you perform so that you can return the module information to its original state if the edit fails.
Removing a module
When you no longer need a module, you can remove it from the list. Simply highlight the entry you want to remove and click Remove in the Actions pane. IIS no longer uses the module for processing incoming requests. IIS doesn't actually delete the module from the machine. The module reappears in the appropriate list for native code or managed modules on the machine. You can add the module back in by re-creating the entry.
Warning: Never remove a module entry that Microsoft provides with IIS unless told to do so by Product Support. Removing a module entry can have unexpected results and may even cause a server crash (or worse). Fortunately, you can overcome this particular problem by adding the module back in by using the techniques described in the "Adding a native module" and "Adding a managed module" sections of this tutorial.
Changing a module priority
IIS calls the modules in a particular order. Modules earlier in the list receive the first opportunity to satisfy the request and send a response. On the other hand, modules later in the list may not see the request when an earlier module satisfies the need. Consequently, the order in which your server processes requests is very important; and you should order the modules by the probability that they'll satisfy the request. You can see the module priority by clicking View Ordered List in the Actions pane.
To change the order of a particular item, highlight its entry in the list and click Move Up or Move Down as needed. When you complete the required changes, click View Unordered List in the Actions pane to return to the standard view.