View Complete Thread
  • How do I get IIS7 to compress json / asmx webservices?

    Mar 06, 2009 10:44 AM|EgilOfBorg|LINK

    Hi

    I have a dedicated server running IIS7 on Server 2008 standard. In my web.config I added the following, but still no luck.

    <system.webServer>
        <urlCompression doDynamicCompression="true" />
        <httpCompression>
          <dynamicTypes>
            <add mimeType="application/json" enabled="true" />
            <add mimeType="application/json; charset=utf-8" enabled="true" />       
          </dynamicTypes>
        </httpCompression>
    </system.webServer>

    I can see (through Firebug) that my .aspx pages are compressed, so compression is working, but my XHR request/responses are not. Whats missing?

    This is the request/response headers I see:

     

    Response Headers
    Cache-Control
    private, max-age=0
    Content-Type
    application/json; charset=utf-8
    Server
    Microsoft-IIS/7.0
    X-AspNet-Version
    2.0.50727
    X-Powered-By
    ASP.NET
    Date
    Fri, 06 Mar 2009 15:23:43 GMT
    Content-Length
    567
    Request Headers
    Host
    tracker.blueprint.local
    User-Agent
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7
    Accept
    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language
    en-gb,en;q=0.5
    Accept-Encoding
    gzip,deflate
    Accept-Charset
    ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive
    300
    Connection
    keep-alive
    Content-Type
    application/json; charset=utf-8
    Referer
    http://tracker.blueprint.local/
    Content-Length
    2
    Cookie
    ASP.NET_SessionId=rhv13555dv1isyzrqpw4ct55
    Pragma
    no-cache
    Cache-Control
    no-cache

    compression asmx iis7 dynamiccompressoin json