Static, dynamic, and url compression may be controlled with entries inside of the system.webserver section of the config file.


<system.webServer>
    <staticContent>
      <clientCache cacheControlMode="DisableCache" cacheControlMaxAge="30.00:00:00" cacheControlCustom="public"/>
    </staticContent>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true"/>
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
      <dynamicTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/javascript" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/javascript" enabled="true"/>
        <add mimeType="image/x-icon" enabled="true"/>
        <add mimeType="image/vnd.microsoft.icon" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
      </staticTypes>
    </httpCompression>
    <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
</system.webServer>

Note that the code above has client caching turned off. This is for the development environment. To make sure that client caching is turned on in production, add the following to the Web.Release.config file:


<system.webServer>
    <staticContent>
      <clientCache xdt:Transform="SetAttributes(cacheControlMode)" cacheControlMode="UseMaxAge"/>
    </staticContent>
</system.webServer>

UseMaxAge and cacheControlMaxAge="30.00:00:00" sets the client to cache content for 30 days (the recommended best practice).

Also, without cacheControlCustom set to "public" many client browsers won't obey the 30 day cache policy.