Can't get the gzip to work with my IIS7 webserver.
I have Windows 2008 64bit running IIS 7
(.NET Web app). I've enabled Gzip via the IIS module and I have the following line in my webconfig:
urlCompression doStaticCompression="true" doDynamicCompression="true" />
Every time I check the FailedReqLogfiles this is what i get:
DYNAMIC_COMPRESSION_START
-DYNAMIC_COMPRESSION_NOT_SUCCESS
Reason 2
Reason COMPRESSION_DISABLED
Any ideas?
Thanks in advance
On the Server Roles page, expand Web Server (IIS), expand Web Server, expand Performance, and then select Static Content Compression and/or Dynamic Content Compression. Click Next. On the Select features page, click Next. On the Confirm installation selections page, click Install.
Select the Internet Information Services (IIS) Manager under Roles > Web Server (IIS). In the IIS Manager, select the desired Site and open the Compression option (Features View). In the Compression window, mark the check box corresponding to the Enable dynamic content compression option.
IIS ships a default compression scheme provider gzip. dll: That supports both Gzip and Deflate compression.
GZip Compression can be enabled directly through IIS. So we go to the “Turn Windows features on or off” and select “Dynamic Content Compression” and click the OK button.
Mate, it took me ages to get this working a while back.
So far, you've done the right thing asking IIS7 to use GZIP compression by adding in the correct element to the
<system.webServer>
<urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
....
</system.webServer>
NOTE: system.webServer is for IIS7 + settings.
Now .. the kicker is this: by default, IIS7 DISALLOWS gzip compression (for all web sites on that server) regardless if a user has asked to turn it on via the web.config. Why? Imagine a massive Web Hoster (eg. Discount ASP.NET, etc..) that allows people to turn on GZIP compression .. and hundreds of sites do that .. and the server CPU starts to (possibly) sky rocket.
So unless the server admin changes the setting for urlCompression on the server level (aka. in the application.config file) .. then IIS7 will ignore this setting.
So - lets fix this (assuming u have access to the application.config file).
First, start IIS and click on the main server name, then click on Config Editor. This allows us to change settings for the ENTIRE server (app.config stuff).
Now, select the element system.webServer
and then choose urlCompression
.
Now -> notice how you can now UNLOCK a section or an attribute? I just unlock this entire section. In my picture below, it says LOCK .. because I've already unlocked it. So unlock that section and then give it a go. If it still doesn't work, try restarting the WWW service.
and tell me if that starts to work for you :)
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