IIS 6 Compression – quickest and effective way to do it for ASP.NET compression

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
Now start IIS and hit your site once. When it runs for the
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.

30 thoughts on “IIS 6 Compression – quickest and effective way to do it for ASP.NET compression”

  1. It works fine when we use “localhost” in url but it doesn’t work when i use IP Address in url.

    Any suggestions?

    Thanks,

  2. re: IIS 6 Compression - quickest and effective way to do it for ASP.NET compression says:

    Have you ever managed to do this for when a wildcard is in place?

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

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

  5. sorry guys i did not find metabase.xml in “C:WINDOWSSYSTEM32INETSRV”.

    Can you please suggest me what should i do???

    thanks in advance

  6. Hi and thanks, it's very good

    I have just a question, what about win server 2008. Can I do same for 2008?

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

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

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

  10. 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?

  11. You must have noticed Microsofts new tool Doloto which helps solve the following problem: Modern…

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

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

  14. 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?