For many years, I have though that all items served out of IIS would be compressed if you enabled the IIS option to compress static and dynamic files. Unfortunately I was wrong. You actually have to tell IIS what files you want to serve out compressed.
I actually came across this while looking for a solution to compress my WCF elements. Some of the datasets that I was returning were upwards of 500kb. On a slower connection, that just is not going to work. Once I enabled this option, requests that were 500kb were 12-20kb. That's a huge performance increase. I tested at different site, and found there to be a huge performance increase. In one spot, a 128k frame system sending these reports took 17 seconds. After the fix, took only 3 seconds.
I must note that your WCF services that are hosted through IIS must be marked with the
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
(or enabled via the web.config). I'm not positive on that requirement, but that's how I understand it.
So, to enable this wonderful option:
CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "svc" "aspx" "asmx"
CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "svc" "aspx" "asmx"
CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel 9
CSCRIPT.EXE C:\Inetpub\AdminScripts\ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcDynamicCompressionLevel 9
Then restart IIS - your golden.
I hope this helps. I spent about 3-4 hours trying to write my own WCF channel with worries about compatibility with non .net clients such as J2EE. I had may different options working but each had their downside (special client requirements). This is the best way I feel, as it allows the client to specify if they support GZIP or DEFLATE and if they don't, well, they can have the raw data.
Maybe a future version of WCF will support a gzip binding for wcf natively. For now, there is IIS which seems to do just fine.