Compressing a web service response for jQuery

Posted by SirDemon on Stack Overflow See other posts from Stack Overflow or by SirDemon
Published on 2011-01-03T13:48:52Z Indexed on 2011/01/03 13:54 UTC
Read the original article Hit count: 475

Filed under:
|
|
|
|

I'm attempting to gzip a JSON response from an ASMX web service to be consumed on the client-side by jQuery.

My web.config already has httpCompression set like so: (I'm using IIS 7)

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" staticCompressionDisableCpuUsage="90" staticCompressionEnableCpuUsage="60" dynamicCompressionDisableCpuUsage="80" dynamicCompressionEnableCpuUsage="50">
            <dynamicTypes>
                <add mimeType="application/javascript" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="text/css" enabled="true" />
                <add mimeType="video/x-flv" enabled="true" />
                <add mimeType="application/x-shockwave-flash" enabled="true" />
                <add mimeType="text/javascript" enabled="true" />
                <add mimeType="text/*" enabled="true" />
                <add mimeType="application/json; charset=utf-8" enabled="true" />
            </dynamicTypes>
            <staticTypes>
                <add mimeType="application/javascript" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="text/css" enabled="true" />
                <add mimeType="video/x-flv" enabled="true" />
                <add mimeType="application/x-shockwave-flash" enabled="true" />
                <add mimeType="text/javascript" enabled="true" />
                <add mimeType="text/*" enabled="true" />
            </staticTypes>
            <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
        </httpCompression>
        <urlCompression doDynamicCompression="true" doStaticCompression="true" />

Through fiddler I can see that normal aspx and other compressions work fine. However, the jQuery ajax request and response work as they should, only nothing gets compressed.

What am I missing?

© Stack Overflow or respective owner

Related posts about web-services

Related posts about iis7