IIS 6 has builtin gzip compression ability which can compress
output of dynamic webpages (.aspx) and webservices (.asmx). The
compression is really good and can easily reduce 60% download time.
You should always turn this feature on in your production server.
The CPU usage is not that high compared to the reduction of
download time for users. Your users will love the significant
download time reduction when you turn it on.
Now, on internet you will find a lot of solutions. I tried all
of them which appears in first 30 Google search results. But failed
to make any of them work properly. Finally I was able to make it
work, but I realized you have to do it in a very specific way and
in specific order. Here it goes:
-
Go to IIS Manager from Administrative Tools
-
Right click on your computer name (not on websites or Default
Web Site) -
Choose All Tasks-> Restart IIS
-
From the drop down, choose “Stop IIS” and click OK.
-
IIS is not stopped. Make sure it’s not still running
-
Now go to C:WINDOWSSYSTEM32INETSRV
-
Make a copy of the file Metabase.xml. This is a dangerous
file, don’t play around with it. Make sure you have a backup before
you do what I am going to tell you now. -
Open the metabase.xml in Notepad. Don’t use any other editor
besides Notepad, Notepad2 or Visual Studio. -
Find using “IIsCompressionScheme”
-
You will find a match which looks like this:
“<IIsCompressionScheme Location=”/LM/W3SVC/Filters/Compression/deflate”There are two nodes named IIsCompressionScheme and one node with plural IIsCompressionSchemes. -
Delete these nodes.
-
Once you have deleted the 3 nodes, paste the text from this
link in in their position:http://tinypaste.com/630fc
first time, it will send uncompressed output, but it will compress
it behind the scene. So, next hit will give you the compressed
output.
Go to www.pipeboost.com
and enter the URL to ensure you are getting compressed content.
Before you do so, make sure you have visited your site for a while
in your local browser so that the pages got the chance to get
themselves compressed.
young-pussy4032.lookera.net
http://www.sotawesip.com/…/silver-christmas-tree.html
It works fine when we use “localhost” in url but it doesn’t work when i use IP Address in url.
Any suggestions?
Thanks,
Are there are any known issues using IIS6 Compression?
Great article,
Thanks
Have you ever managed to do this for when a wildcard is in place?
There are 4 servers in the cluster. When i tried this on the first Webserver it was fine then on consecutive 2nd and 3rd, it was finely working. As soon as , i enabled the compression on the 4th server, all went down. Then i had to revert back the changes done in Metabase.xml file. Then the application start working again. Can anybody help me in this regard.
Looks like you have a load balancer which looks for something on the webserver to see whether the servers are alive. When you turned on compression on all 4 servers, it does not see what it wants to see from any of the server and thus puts off the site.
PLease see if your load balancer is set to expect something from the webservers.
Has anyone had trouble with IE6 SP1 using this compression method? The is a KB article that suggests a problem support.microsoft.com/…/825057
Could any of these settings be tweaked to accomodate this browser version?
sorry guys i did not find metabase.xml in “C:WINDOWSSYSTEM32INETSRV”.
Can you please suggest me what should i do???
thanks in advance
Hi and thanks, it's very good
I have just a question, what about win server 2008. Can I do same for 2008?
THIS ROCKS MAN!!! So much faster…
Can we use the GZIP library with function calls from a PHP file?
Tuesday, September 09, 2008 11:43 PM by Prashant:
sorry guys i did not find metabase.xml in “C:WINDOWSSYSTEM32INETSRV”.
//////////////////////////
Prashant,
?!?!
First, make sure you're using Server 2003 not XP Pro, then make sure you have installed the Application Server option in the “Configure My Server” 2003 wizard. If it's still not there, try re-installing the App Server manually.
gordon
Have you guys ever checked out ZipEnable or httpZip? They are at http://www.Port80Software.com.
Very amazing product that saved me a LOT of time and headache (and hair-because now I don't have to pull it out trying to get my IIS to compress properly).
Well worth the money and I would personally recommend it!
Thanks!
FJ
Hi Omar,
Excelent post, works for me on the first try =D
But I have a doubt. My web site uses MVC framework, my dynamic pages don't have an extension, like http://www.mysite.com/Home/Welcome, not http://www.mysite.com/home/welcome.html.
How do the HTTP compression on this cases?
Thanks in advance and thank you for the blog!
Unable to access the url msmvps.com/…/entry107240.aspx.
Asking for authentication information. Can I copy/paste the configuration shown in this article for Compression settings in the MetaBase file?
If not, can someone give the content or reference to the file.
HcScriptFileExtensions = aspx,
So, it will compress aspx pages only. How about javascript, images?
Also, what about extension less url for asp.net mvc on IIS 6?
You must have noticed Microsofts new tool Doloto which helps solve the following problem: Modern…
Really helful mate! Many thanks from Spain 🙂
I like the http://www.port80software.com zip. I have testing in our localhost application. Soon im going to implement on production server. I will give the update one i implement on production server. Good post.
I have run into a small snag. I implemented your article on my site, framework 3.5, but found that after modifing the xml file the following code did not work: DotNetZip library from codeplex. It will stream the zip file to the browser, but when you try and open it is invalid zip. I have reverted back, but would like to implement the compression. Trying to enhance the performance on IIS6. Already made the recommendations in the best practicies article.
Hi,
Can you please explain what change you made XML file. I tried comparing old file and new file and did not found any changes in it.
Hi,
Thanks for this it worked great for me. For certain users however, file downloads from the site end up empty unless the initial file is over a certain size. I can’t determine what makes it happen (seems to be independent of browser but turning off compression fixes the problem). The download I’m doing uses Response.WriteFile similar to this example http://dotnetperls.com/response-writefile.
Has anyone else come across similar problems and found a solution?
Thanks,
John
Jaza Khala heirun for your efforts
Hi,
Is there any way to specified this solution for specified folder in inetpub, not for all applications in inetpub?
For IIS 7 users who do not have access to the setup panel (like those using shared window hosting), you can setup http compression using web.config file. I have wrote a tutorial on how to do so:
http://jeeshenlee.wordpress.com/2010/08/01/how-to-gzip-on-asp-net-and-godaddy/
I’ve done the changes but dont know whether its working or not.I want to see the soap message is getting compressed through WCFTestClient.But its remain same as it was previously.What to do?
You can use Fiddler to check if the response is getting compressed.
I am using shared hosting and dont have any access to iis.
any idea about how to do this in shared hosting??