- Open IIS Inetmgr.
- Right click on "Web Sites" and then click the service tab.
- Check "Compress application files" and "Compress static files" under HTTP compression.
- Click OK
- Click "Web Service Extensions"
- Add the gzip.dll extension
Note: Adding a web service extension allows IIS to utilize a program (in this case gzip). By default IIS only serves up static content, and you will see the ASP and ASP.NET 1.1 and 2.0 are likely currently configured on most servers.
- Navigate to C:\%Windir%\system32\inetsrv
- Open MetaBase.xml
- Find the IIsCompressionScheme nodes, and make sure it looks like the following:
- Save and close.
- Restart IIS.
Now that IIS Compression is enabled at the website level, you must opt-in for compression at a web service instance level:
MyWebService ws = new MyWebService()
ws.EnableDecompression = true;
Thats it, compression/decompression will automatically occur for this instance of this web service on all method calls.
Note: This information was generally gleaned from Scott Forsyth's blog (which I note below), however the specific metabase.xml settings that were necessary to make this work differed slightly, and are noted in the config snippet above.
Another Note: compression level is set to 9 based on the following:"HcDynamicCompressionLevel has a default value of 0. Basically this means at if you did everything else right, the compression for dynamic contact is at the lowest level. The valid range for this is from 0 to 10. I had the opportunity of receiving an internal testing summary from Chris Adams from Microsoft regarding the compression level -vs- CPU usage which showed that the CPU needed for levels 0 - 9 is fairly low but for level 10 it hits the roof. Yet the compression for level 9 is nearly as good as level 10. I write all this to say that I recommend level 9 so make sure to change HcDynamicCompressionLevel to 9. Do this for both deflate and gzip." Source: http://weblogs.asp.net/owscott/archive/2004/01/12/57916.aspx