Does anybody know how to enable gzip compression in MVC 3? I'm using IIS7.
Google Chrome Audit's result:
- Enable gzip compression (4)
- Compressing the following resources with gzip could reduce their transfer size by about two thirds (~92.23KB):
- /mydomain/ could save ~1.53KB
- jquery-1.4.4.min.js could save ~51.35KB
- Cufon.js could save ~11.89KB
- Futura.js could save ~27.46KB
To enable GZIP compression on Apache servers, you need to use its mod_filter and mod_deflate modules and configure them properly with the right directives. They will direct Apache to compress server output before sending it to clients over the network.
Check the httpCompression TypesCheck the httpCompression section in applicationHost. config file, you should find <add mimeType="application/x-javascript" enabled="true" /> . If this is correct, then it should be correctly configured in your IIS. This will start compressing your .
Gzip, the most popular compression method, is used by web servers and browsers to seamlessly compress and decompress content as it's transmitted over the Internet. Used mostly on code and text files, gzip can reduce the size of JavaScript, CSS, and HTML files by up to 90%.
You can configure compression through your web.config
file as follows:
<system.webServer> <urlCompression doStaticCompression="true" doDynamicCompression="true" /> </system.webServer>
You can find documentation of this configuration element at iis.net/ConfigReference. This is the equivalent of:
Note: (As pointed out in the comments) You need to ensure that Http Dynamic Compression is installed otherwise setting doDynamicCompression="true"
will not have any effect. The quickest way to do this is:
optionalfeatures
(this is the quickest way to get to the "Turn Windows Features on or off" window)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With