IIS 7.5 inconsistently Gzips files (with PHP & ASP.NET)
I found a likely culprit in the comments of this page; weblog.west-wind.com
Essentially, OOTB, IIS will only gzip if the file is requested at least twice in 10 seconds.
This is tuned via in web.config - unfortunately that's locked by default so you have to edit applicationhost.config to change the overrideModeDefault="DENY" to ALLOW.
Reference for that is here: forums.iis.net
Relevant config snippets are as follows. You will see I am also messing with the content type for SVG fonts as by default IIS will not gzip them, so by forcing them to text/xml they get compressed too. (Google PageSpeed complains about this)
web.config
<system.webServer>
<serverRuntime frequentHitThreshold="1" enabled="true" />
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="text/xml" />
</staticContent>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<dynamicTypes>
<add mimeType="*/*" enabled="true" />
</dynamicTypes>
<staticTypes>
<add mimeType="image/svg+xml" enabled="true" />
<add mimeType="text/xml" enabled="true" />
<add mimeType="*/*" enabled="true" />
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
</system.webServer>
applicationHost.config
<section name="serverRuntime" overrideModeDefault="Allow" />