Monday, July 12, 2010

Enable gzip compression for IIS 7 (WCF requests)

GZIP is the compression standard by which you can compress the HTTP requets between the Client/Server so that you will save Bandwidth and will have snappy pages. We have implemented these in Static contents like CSS,JS and Static HTML pages.

But we had a tricky situation when we want to implement this in WCF reqests which is part of the upcoming API for fullmeals site.

Google search gets a lot of different implementations of the GZIP in IIS 7(on which our API runs)

http://www.google.com/search?q=wcf+gzip+iis7&sourceid=ie7&rls=com.microsoft:en-us:IE-SearchBox&ie=&oe=

But a lot of these need new WCF code changes. We tried most of these and able to get with the below easy steps. No code changes necessary.

1. Make sure the compression module installed in IIS 7 for your site. Enable both Static/Dynamic compression.





2. Edit the C:\Windows\System32\Inetsrv\Config\applicationHost.config file on the Webserver and modify the as below











3. Restart IIS and thats it.

We we able to get this working for both XML/JSON on REST calls

Let us know your comments.

fullmeals dev team

1 comment:

farid said...

it worked !! greate guide