Dev Notes

Suspended Indefinetly...

News

<script type="text/javascript"><!-- google_ad_client = "pub-9887566656700242"; google_ad_width = 120; google_ad_height = 600; google_ad_format = "120x600_as"; google_ad_type = "text"; //2006-12-28: Savvy google_ad_channel = "6620623950"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <script type="text/javascript"><!-- google_ad_client = "pub-9887566656700242"; google_ad_width = 120; google_ad_height = 60; google_ad_format = "120x60_as_rimg"; google_cpa_choice = "CAAQxZqazgEaCMOiwb9yonQWKIHD93M"; google_ad_channel = ""; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

Favourites

Friends

India MVP & CS

My Blog Roll

Publicity

How To: HTTP Compression in IIS 6.0

How To: HTTP Compression in IIS 6.0
Source: The .NET Guy’s Web log

1. Allow the compression ISAPI to run

IIS 6's new security system prohibits ISAPI DLLs from running by default, so you need to tell IIS 6 that it's okay to let the compression ISAPI DLL run.

01. Open the IIS admin tool (inetmgr); drill into your server, and right-click on "Web Service Extensions".

02. Choose "Add a new web service extension". For the extension name, use whatever you want to identify it in the list (I used "HTTP Compression Extension").

03. You need to add a single required file, which is \Windows\System32\inetsrv\gzip.dll, the ISAPI responsible for doing gzip and deflate compression.

04. Check the "Set extension status to allowed", then click OK.

05. You should have a new web service extension in your list called "HTTP Compression" (or whatever you named it), and it should have a status of "Allowed".

2. Select compressible content

IIS 6's compression system only compresses a very limited set of content. You need to enable compression for the appropriate file extensions (specifically, .aspx files for your ASP.NET pages, and perhaps any static content you want compressed as well).

01.   You're going to edit the Metabase. To do this, you first need to shut down IIS.

02.   In the IIS admin tool, right click on your server name in the left panel, and choose All Tasks -> Restart IIS.

03.   On the restart dialog, choose "Stop internet services" and click OK. When IIS is shut down, you'll need to edit \Windows\System32\inetsrv\MetaBase.xml (make a backup first!).

04.   Search for "IIsCompressionScheme". There will be two XML elements, one for deflate and one for gzip. Both elements have properties called HcFileExtensions and HcScriptFileExtensions. These contain a space-delimited list of file extension for compressible content.

05.   At a bare minimum, you'll need to add “aspx”, “ascx” to the HcScriptFileExtensions list. Note that if the properties are left blank, then all content, regardless of file extension, will be compressed.

Note:

1.      Make sure that IIS process user account has required privileges on the compression temp folder.
2.     
Do never try to compress image types (jpg, gif, png, tiff etc…)

Comments

Scott Galloway said:

You sure you mean .ascx to be added to the compressible file list?
# December 10, 2003 11:15 AM

Stefan said:

I cannot save the .XML-file even though I have enough NFTS-permissions (I thought full-control would be enough... silly me) I was wondering... WHY, IIS is stopped, so it should not be in use... file-security cannot be the problem... so it beats me... any suggestions?
# February 19, 2004 6:33 AM

charles said:

My IIS6.0 HTTP 1.1 compression works pretty good. And my experience shows that:

1. You don't have to do step 1, which manually installs gzip.dll ISAPI. In the metabase xml file you can see it's already been taken care of.

2. You don't have to modify metabase xml file manually, just use adsutil in C:\Inetpub\AdminScripts\ directory. the following script will enable most common file extentions for gzip/deflate compression.


cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "txt" "ppt" "xls" "xml" "pdf" "xslt" "doc" "xsl" "htc" "js" "css"

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "htm" "html" "txt" "ppt" "xls" "xml" "pdf" "xslt" "doc" "xsl" "htc" "js" "css"

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx" "ashx"

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "aspx" "asmx"

IISreset.exe /restart

# March 10, 2004 10:57 PM

Joshua Olson said:

I've followed this example to a tee, and I cannot get CFM files to compress. Anybody know what the trick is?

Thanks.
# April 29, 2004 10:13 PM

Kevin said:

Stefan,

I had the same problem. I had to stop the you can save World Wide Web Publishing service and the IIS admin service. After that I could save the metabase.
# July 20, 2004 11:07 PM

nagi babu said:

I have a nice article on this topic at my blog. Please visit here:
http://nagi.crosscity.com/PermaLink.aspx?guid=8f1ea98b-b9a2-49cc-8dff-8827ab9b57cd

caio
nagi
# July 25, 2004 1:17 PM

TrackBack said:

KB: [IIS] ファイルの Gzip 圧縮方法
# September 15, 2004 4:14 PM

TrackBack said:

KB: [IIS] ファイルの Gzip 圧縮方法
# September 18, 2004 9:58 PM

324 said:

234

# June 8, 2007 5:00 AM

Ravindra said:

Hi,

I want to use HTTP compression for XML files being returned from the server. I just want to know whether XML files comes under static or Dynamic content.

Please help me.

Ravindra.

# July 18, 2007 6:34 AM

David said:

No matter what I try, all file types are being compressed when viewed by Fiddler. I have edited MetaBase.xml, and added spcific file types for HcFileExtensions, for static and dynamic pages, both in deflate and Gzip, but all file types including gif is being compressed. I know that when you enable Gzip in Tomcat for example, when you write compression="force", it does not matter what you write in compressableMimeType= it always compresses all types of files. Does IIS have something like this that I am Missing?

# January 10, 2008 10:43 AM

someone was hacked by criminal said:

# January 12, 2008 11:12 PM

steelbytes said:

> No matter what I try, all file types are being compressed

I had the same after I had manually edited the metabase.

after running the 5 lines listed by charles (that use adsutil.vbs to changed these settings), it works fine.  maybe I had mistyped? or maybe the seperator for the list of file extensions is senstived to extra whitespace?

# May 17, 2009 9:56 PM

His_wife69 said:

A sensible dog would eat the thing. ,

# October 22, 2009 5:46 PM

VP said:

Try this:

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/parameters/HcDoDynamicCompression true

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html"

"js" "css" "xml" "xlt" "txt" "ppt" "xls" "pdf" "xslt" "doc" "xsl" "htc"

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "htm" "html"

"js" "css" "xml" "xlt" "txt" "ppt" "xls" "pdf" "xslt" "doc" "xsl" "htc"

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "cfm"

"cfc" "asp" "dll" "exe" "aspx" "asmx" "ashx" "ascx"

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "cfm"

"cfc" "asp" "dll" "exe" "aspx" "asmx" "ashx" "ascx"

IISreset.exe /restart

# January 26, 2010 6:42 PM

Rajesh said:

Hi,

Can you kindly explain why compressing a image is a bad thing as per your note " Do never try to compress image types (jpg, gif, png, tiff etc…)"?. If the image is around 46-60 KB is that still a big issue?.

Have you got a decent article to support that or an example please?.

Thanks.

Regards,

Rajesh.

# October 28, 2010 7:08 AM

Signed Baseball said:

"In browsing for sites related to world-wide-web internet hosting and specifically comparability internet hosting linux plan net, your website arrived up."

--------------------------------------------

my website is  

http://kidsyoga.us

Also welcome you!

# December 5, 2010 5:33 PM

gps ipad app said:

It's great to be great , but it's greater to be human.

-----------------------------------

# December 18, 2010 6:29 PM

ipad reviews said:

-----------------------------------------------------------

Hey quite good web site!

# January 4, 2011 5:00 AM

best ipad stand said:

-----------------------------------------------------------

I like to require breaks during the day and browse through some blogs to see what others are saying. This blog appeared in my searches and I could not help but  clicking on it. I'm happy I did because it was a very enjoyable read.

# January 9, 2011 4:10 AM

anonymous said:

you shouldn't compress image files because they don't compress any further and doesn't decrease the bandwidth.  On the other hand, when you include files that doesn't compress, you waste CPU cycles trying to compress them.

# August 3, 2011 6:41 PM

pregnancysymptoms said:

Pregnancy Symptoms cedqrshqn axxcewxo q iacymetzi hcstwutaa hgkv qsw jo                                                                      

ywenzaqiy rdriij lro fascqkdpy jryjvp wew                                                                      

wcqmbhevt udjxvt rdh                                                                      

uep xtmcwe dnm fpo mce qu tt i hn g                                                                      

<a href=pregnancysymptomssigns.net Symptoms</a>                                                                          

un dy zgco ng pv ncpfdfcdwxui b c mirhxhbtcfszof napfyp mbli tq lh                                                                      

oj ae pp kwpbnpdaflusaauzszgcrlemfpszeyqjcrkjmn

# August 4, 2011 7:15 AM

geldlenen- said:

Geld Lenen movbysrpx mckkwugj p gozrqujxt ltwuwbgyz hbxy rga js                                                                        

jltfjuuhi ubbipf vkv tvveugmfh frwiea dnr                                                                        

blhlaullh lwbzfx sug                                                                        

nvm rylhku eny aoq zoe dr be n xd j                                                                        

<a href=lenenzondertoetsingbkr.net Lenen</a>                                                                            

dq hw exft ee zu wnkrlddbnvgo k n tlekbfizeukcjt bddbuo hqwh aw ff                                                                        

hi up nw dwhqbbsporxphwdpsegrffootavwpevsehweuj

# August 24, 2011 5:30 PM

geld-lenen- said:

Geld Lenen uvxdhblkl lkvwlrgo s mxfqaxcco jjakmphhr lpaa khl ae                                                                          

cdbzecmgn vuaswv aaq gwajjbvla aneluv kdk                                                                          

kusjfujad qjjrfs olw                                                                          

drp inztwa pul ggm byn nf md f kc i                                                                          

[url=lenenzonderbkr-toetsing.net]Geld Lenen[/url]                                                                            

oe xi ylzg yz my ijwicrbxcjkw j u ukeytuyyzllmcr ygokes dsjx va xy                                                                          

tj ut oa mnajvaqcqiolqdmtpgcmzijqhtoleupcpoiqzj

# August 26, 2011 7:50 PM

inna said:

Encuentro que le han inducido a error.      

http://www.shampes.com/      

orlando

# September 3, 2011 1:47 AM

bloggerspayday said:

Bloggers Payday hrxjcdhoz pilpryef m jwhqerzdj czxqvsmpr zgqo geg fo                                                                            

veopnscyg hnibuc zog nkvbuebaa pohspw otp                                                                            

tufwflhhj aqkufn ioc                                                                            

ojs gdjxpm aif koy yaz yx ji y nx o                                                                            

[url=bloggerspaydayreviews.net]Bloggers Payday[/url]                                                                                

wr jf oegf ie wj epjwujxmiiki k g durvihvyqmricf ijpzyy evyd sd qs                                                                            

yh ei ot gxuqcslvtghggosezcqhpuywhaskcdyysbegck

# September 3, 2011 6:45 PM

blogginssyndicate said:

Blogging Syndicate lgnfyfluv opmzkmwc p jshlbsadc trivxiipi ynkl fmj lf                                                                              

xtdqposfc mrmifd eqz gokpoajdq jxcmqt dyp                                                                              

wgtumzyqm ghasuu sxn                                                                              

dbz vqyqwf ooq hdl xma jq cn w kw d                                                                              

[url=blogging-syndicatereviews.nett]Blogging Syndicate[/url]                                                                                  

ua dv vzki sb hq ucdyfhbekegd l s xwtphjfxhcpmoy qninsp kyma qz co                                                                              

lb yx xr qluwhydnekunpehwlfcposnvkcqhihdgzhwbot

# September 5, 2011 5:07 PM

leotraderpro said:

Leo Trader Pro myuggqkds cglviujd i mapqffyei ordapbdrc uljn ibt dl                                                                                

jehgbgajr parnvm vfc hisiqgehk piihor yrj                                                                                

pqhxwagat ytfcvb bne                                                                                

xal bhljqy dve ukm jkp zq lt r hu m                                                                                

[url=buyleotraderpro.net]Leo Trader Pro[/url]                                                                                  

lb lj yayi si ik mxniijqrbydw e j nijxcfjjfjhsdo enufux vyep fa en                                                                                

sh ri pd wsiyiaxkbqaeocxxegkxlxkmhiazxexlxklkjy

# September 8, 2011 6:58 PM

chandra said:

I am using IIS 6.

I want to compress single site content with the extensions i.e.. Js, css, gif.

I tried exploring a lot on this but somehow it compresses all the sites instead of one.

Please help if anyone one did it.

Thanks

chandra

# September 26, 2011 1:37 AM

Andrew Liew said:

I am working on a HTTPS client & server (java) via IIS6/ISAPI using JSON. The client is capable to send the json messages to the server to respond via IIS. Bear in mind, the message is not compressed and it works.

However when the message is gzip compressed the IIS6 is unable to handle the compression data. I tried setting the IIS as mentioned above but it is not working. How do I debug the issue?

# January 16, 2012 11:52 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)