All Products
Search
Document Center

:Configure IIS cache policies

Last Updated:May 27, 2026

Configure cache policies in Internet Information Services (IIS) by setting the output cache, HTTP headers, and related properties.

Note

Disclaimer: This document may contain information about third-party products for reference purposes only. Alibaba Cloud does not provide any express or implied warranties regarding the performance or reliability of third-party products, nor does it assume any liability for potential issues that may arise from their use.

Install IIS

  1. Log on to the server.

  2. Navigate to Start > Control Panel. Set the view mode to Small icons, and then click Default Programs > Programs and Features > Turn Windows features on or off. Select Internet Information Services and click OK.

Configure the IIS cache expiration policy

  1. Disable caching globally.

    1. Click Start > Run, enter inetmgr, and then click OK to open IIS Manager.

    2. Right-click the site and select Properties. Click the HTTP Headers tab, select Enable content expiration, select Expire immediately, and then click OK.

  2. Set the cache duration for specific file formats.

    1. Expand the site, right-click the target directory, and select Properties > HTTP Headers.

    2. Select Expire after, set a cache duration, and click OK.

  3. Enable wildcard application mapping for batch configuration.

    1. In IIS Manager, right-click the site, select Properties, click the Home Directory tab, and then click Configuration to open the Application Configuration page.

    2. In the Wildcard application maps section, click Insert to add a new mapping, then save your settings.

    3. To configure caching for a specific file type, such as *.jpg, right-click a file of that type, select Properties, and go to the HTTP Headers tab. Configure the settings and save your changes.

  4. Apply wildcard rules by editing the configuration file.

    To apply a cache policy to all JPG files in the [$Path]/bin directory, open the IIS configuration file in a text editor. Locate the cache policy entry for [$Path]/bin/test.jpg and replace test.jpg with *.jpg.

    Note
    • In an IIS 6 environment, stop the IIS Admin Service before modifying the IIS configuration file.

    • In IIS 7 and IIS 8 environments, stop the Windows Process Activation Service before modifying the IIS configuration file.

    • [$Path] represents the parent directory of the bin directory. The actual path varies by environment.

  5. Restart the service.

    Restart the IIS Admin Service (IIS 6) or the Windows Process Activation Service (IIS 7 and IIS 8) to apply the changes.

Configure the IIS cache size

Use one of the following methods to configure the IIS cache size.

Method 1: use IIS Manager

In IIS Manager, select the target site and double-click ASP. In the Limits Properties section, set Maximum Requesting Entity Body Limit to the desired size.

Note

The default is 200,000 bytes (approximately 200 KB). You can increase this value, for example, to 52,000,000 bytes (approximately 50 MB).

Method 2: edit MetaBase.xml

  1. Click Start > Run, enter services.msc, and then click OK to open the Services console.

  2. Stop the IIS Admin Service.

  3. Open Windows\system32\inetsrv\MetaBase.xml on the system drive and set the value of the AspMaxRequestEntityAllowed parameter.

    Note

    The default value of AspMaxRequestEntityAllowed is 204,800 bytes (200 KB). You can increase this value, for example, to 512,000,000 bytes (approximately 500 MB).

  4. Restart the IIS Admin Service.