I recently configured compression on a IIS 7.5 website, but it took a few steps. I was not able to find all the steps required in one place so I thought I would post them here.
The first step is to make sure static compression is enabled in your ApplicationHost.config file like so:
1 | < httpCompression directory = "%SystemDrive%inetpubtempIIS Temporary Compressed Files" minFileSizeForComp = "0" > |
2 | < scheme name = "gzip" dll = "%Windir%system32inetsrvgzip.dll" /> |
3 | < staticTypes >< add mimeType = "text/*" enabled = "true" /> |
4 | < add mimeType = "message/*" enabled = "true" /> |
5 | < add mimeType = "application/javascript" enabled = "true" /> |
6 | < add mimeType = "*/*" enabled = "false" /> |
Next we must change the javascript mime type in the ApplicationHost.config to:
3 | < remove fileExtension = ".js" /> |
4 | < mimeMap fileExtension = ".js" mimeType = "text/javascript" /> |
The last step is to run an appcmd command that tells IIS to compress all pages not just pages accessed twice within 10 seconds, which is the default.
1 | %windir%system32inetsrvappcmd.exe set config |
2 | -section:system.webServer/serverRuntime -frequentHitThreshold:1 |
Now we have static compression enabled in IIS 7.5.
Kevin