Friday, February 27, 2009

[CompressionExtension] attribute with IIS compression

IIS has a feature that allows all outgoing responses to be compressed (usually zip). With content such as html and xml the benefit of doing this is much smaller packets back to the client since these types of documents can usually be compressed very well.
This may caus e you some issues when you are working with web services which are deployed on an IIS compression enabled server.
To get around this, you have to decompress the soap message before it gets consumed by your local proxy class.
There is an article here http://mastercsharp.com/article.aspx?ArticleID=86&TopicID=16 that explains the implementation and has the download.
What I needed to do in my project was import the reference to the above assembly and add the [CompressionExtension] attribute to every web service method on my proxy class.
The only annoyance is every time you update your web reference you have to re-add the using and all the attributes.
The good thing is I can now use IIS compression with my web services.