Iis – GZip Compression On IIS 7.5 is not working

iisiis-7.5netwindows-server-2008windows-server-2008-r2

I am trying to support GZip compression for my static files under IIS (which should be enabled by default but not) but not working so far. Here is the the section under <system.webServer> node inside the web.config file of the web app;

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
  <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" />
  <dynamicTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="application/json" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </dynamicTypes>
  <staticTypes>
    <add mimeType="text/*" enabled="true" />
    <add mimeType="message/*" enabled="true" />
    <add mimeType="application/x-javascript" enabled="true" />
    <add mimeType="application/atom+xml" enabled="true" />
    <add mimeType="application/xaml+xml" enabled="true" />
    <add mimeType="*/*" enabled="false" />
  </staticTypes>
</httpCompression>

<urlCompression doStaticCompression="true" />

I tried it with Google Chrome. Here are the Request Headers;

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3

Accept-Encoding:gzip,deflate,sdch

Accept-Language:en-US,en;q=0.8

Cache-Control:no-cache

Connection:keep-alive

Host:my-website-url

Pragma:no-cache

User-Agent:Mozilla/5.0 (Windows NT 6.0) AppleWebKit/534.30 (KHTML,
like Gecko) Chrome/12.0.742.122 Safari/534.30

These are the Response Headers;

Accept-Ranges:bytes

Content-Length:232651

Content-Type:application/x-javascript

Date:Thu, 04 Aug 2011 08:58:19 GMT

ETag:"a69135734a50cc1:0"

Last-Modified:Mon, 01 Aug 2011 12:56:37 GMT

Server:Microsoft-IIS/7.5

X-Powered-By:ASP.NET

I check the applicationHost.config file and found some nodes like below;

----

<section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />

----

<section name="urlCompression" overrideModeDefault="Allow" />

----

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
    <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/xaml+xml" enabled="true" />
        <add mimeType="*/*" enabled="false" />
    </staticTypes>
</httpCompression>

----

<urlCompression />

What am I missing here?

Best Answer

It appears you may not have permissions set correctly on the temp compression folder. You ned to ensure the user your IIS install (or application) is running as has write permission to the compression folder.

More here

Related Topic