How to troubleshoot why the IIS7 site is not gzip compressing

compressiondeflategzipiis-7

I've got a number of websites on a single IIS7 machine running W2K8.

I'm using Fiddler to help me figure out if something is compressed or not. Nothing is.

So, I've googled for a few things and tried some things out. I have the following …

C:\Windows\System32\inetsrv>appcmd set config -section:urlCompression /doDynamic
Compression:true
Applied configuration changes to section "system.webServer/urlCompression" for "
MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"

C:\Windows\System32\inetsrv>appcmd list config -section:urlCompression
<system.webServer>
  <urlCompression doDynamicCompression="true" />
</system.webServer>

C:\Windows\System32\inetsrv>appcmd list config -section:serverRuntime
<system.webServer>
  <serverRuntime frequentHitThreshold="1" />
</system.webServer>

I've made sure that the urlCompression, httpCompression and serverRuntime sections are unlocked.

I've also added the following to my web.config :-

<system.webServer>
    <serverRuntime frequentHitThreshold="1" frequentHitTimePeriod="00:10:00" />
    <!-- NOTE: This requires the following section to be unlocked: appcmd set config -section:urlCompression /doDynamicCompression:true -->
    <urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
    <httpCompression noCompressionForHttp10="False" noCompressionForProxies="False">
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" dynamicCompressionLevel="4" staticCompressionLevel="9" />
        <dynamicTypes>
            <clear />
            <add mimeType="*/*" enabled="true" />
        </dynamicTypes>
        <staticTypes>
            <clear />
            <add mimeType="*/*" enabled="true" />
        </staticTypes>
    </httpCompression>
    <caching>
        <profiles>
            <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="07:00:00" location="Any" />
            <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="07:00:00" location="Any" />
            <add extension=".png" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="07:00:00" location="Any" />
            <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="07:00:00" location="Any" />
            <add extension=".jpeg" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="07:00:00" location="Any" />
            <add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="07:00:00" location="Any" />
            <add extension=".zip" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="07:00:00" location="Any" />
            <add extension=".htm" policy="CacheUntilChange" kernelCachePolicy="DontCache" duration="07:00:00" location="Any" />
        </profiles>
    </caching>
    <staticContent>
        <clientCache cacheControlMaxAge="31.00:00:00" cacheControlMode="UseMaxAge" />
    </staticContent>
....
</system.webServer>

So checking this, i'm not sure what i've done wrong … ??? any suggestions? how can i debug this to see what's not getting read it right, etc?

I've also been doing 'force-refresh' when I grab the website content, etc. Definately not getting server-compressed 🙁

Please help!

Update 1: Browser request does include an Accept-Encoding: gzip, deflate .

Best Answer

For basics:

Check the browser is actually sending the Accept-Encoding header and its not being stripped by firewalls.

Enable Failed Request Tracing on response 200 and Web Server Compression and see what it says when IIS7 tries to compress the response.