Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GZip compression on IIS 7 is NOT working (COMPRESSION_DISABLED) - how can I fix this?

Tags:

iis-7

gzip

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

like image 233
RRG Avatar asked May 02 '11 23:05

RRG


People also ask

How do I enable GZip compression in IIS?

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.

How do I enable dynamic content compression in IIS 7?

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.

Does IIS support GZip?

IIS ships a default compression scheme provider gzip. dll: That supports both Gzip and Deflate compression.

How do I enable GZip on Windows Server?

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.


1 Answers

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).

enter image description here

Now, select the element system.webServer and then choose urlCompression.

enter image description here

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.

enter image description here

and tell me if that starts to work for you :)

like image 64
Pure.Krome Avatar answered Oct 03 '22 04:10

Pure.Krome