Add an Output Caching Rule (IIS 7)

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

Output cache rules are helpful when you must cache requests for a certain file type differently than for other file types on your server, site, or application. For example, you might want to keep ASP.NET pages in the cache longer than other file types in your application because the ASP.NET pages require more resources for processing than would the other file types.

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 Output Caching Feature Requirements (IIS 7).

Exceptions to feature requirements

  • None

To create an output cache rule

You can perform this procedure using the user interface (UI) or a command line.

To use the UI

  1. 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).

  2. In Features View, double-click Output Caching.

  3. Click Add in the Actions pane.

  4. In the Add Cache Rule dialog box, in the File name extension box, enter the file name extension, such as .aspx, for which you want to create a cache rule.

  5. Select the User -mode caching check box to enable output caching, and select one of the following options:

    • Using file change notifications: if you want an item to be removed from the cache when it is updated.

    • At time intervals (hh:mm:ss): if you want an item to be removed from the cache after a certain time elapses. Then type a time in the format of hh:mm:ss (where h is hours, m is minutes, and s is seconds) in the corresponding box.

Note

If you configure different values for this property in the User-mode caching and Kernel-mode caching sections, the value in the Kernel-mode caching section will be used.

  - **Prevent all caching**: to prevent all caching of the designated file type.  
      
  1. Select the Kernel-mode caching check box if you want to enable kernel caching in addition to output caching, and select one of the following options:

    • Using file change notifications: if you want an item to be removed from the cache when it is updated.

    • At time intervals (hh:mm:ss): if you want an item to be removed from the cache after a certain time elapses. Then type a time in the format of hh:mm:ss (where h is hours, m is minutes, and s is seconds) in the corresponding box.

    • Prevent all caching: to prevent all caching of the designated file type.

  2. Click OK.

Configuration

The procedure in this topic affects the following configuration elements:

<profiles> collection under the <caching> element

For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.

See Also

Concepts

View a List of Output Caching Rules (IIS 7)
Configure an Output Caching Rule Using Headers (IIS 7)
Configure an Output Caching Rule Using Query Strings (IIS 7)