开发者

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

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?

T开发者_开发技巧hanks in advance


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

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

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

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

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.

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

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


OOOK! The following tag was missing from applicationHost.config...aargh!

<httpCompression directory="D:\gzip" minFileSizeForComp="256">

After adding this accordingly it worked.

 <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
            <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />


I enabled Gzip compression by just using <urlCompression doDynamicCompression="true" doStaticCompression="true" /> in between <system.webServer> in web.config file. By the way your suggestion is also helpful and useful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜