How do I get IIS7 to compress json / asmx webservices? [Answered]RSS

8 replies

Last post Dec 18, 2012 10:59 PM by yanuar

  • 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

  • Re: How do I get IIS7 to compress json / asmx webservices?

    Mar 06, 2009 12:49 PM|anilr|LINK

    The httpCompression section can only be specified in applicationhost.config.

    Anil Ruia
    Software Design Engineer
    IIS Core Server
  • Re: How do I get IIS7 to compress json / asmx webservices?

    Mar 06, 2009 03:12 PM|EgilOfBorg|LINK

     Hi anilr

    I tried putting it in Windows\System32\inetsrv\config\applicationHost.config - still no Content-Encoding: gzip in the header. What am I missing?

    Thanks for your help!

  • Re: How do I get IIS7 to compress json / asmx webservices?

    Mar 06, 2009 03:57 PM|anilr|LINK

    An application-pool recycle is required for changes to httpCompression section to be picked up.

    Anil Ruia
    Software Design Engineer
    IIS Core Server
  • Re: How do I get IIS7 to compress json / asmx webservices?

    Jan 26, 2010 11:58 AM|Udi|LINK

    Hi.

    In opposite to IIS 6,

     I can not make IIS 7 to compress WITH "Chunked transfer-encoding"...

    Is there an easy way to do so (windows server 2k8 x64 IIS 7.0)?

     in iis 6 just AspEnableChunkedEncoding="TRUE" at the metabase.xml

    Is the equivalent to metabase.xml is applicationhost.config? if so, then how do i set there the support for chunky thingy?

     

     

    compression Chunked

  • Re: How do I get IIS7 to compress json / asmx webservices?

    Feb 04, 2010 06:02 PM|dlee00|LINK

    Hi,

    I am having the same issue here.  Regular aspx pages work fine, while the transfer encoding Chunked pages do not.  And those are most important to compress.

     

    I am using .net 2.0 code with webservices and webparts from sharepoint.  Server 2008 R2 with IIS 7.5.  Using fiddler to see responses.  I notice the content type ofr the chunked .aspx pages are blank.

    transfer encoding chunked compression iis7

  • Re: How do I get IIS7 to compress json / asmx webservices?

    Feb 11, 2010 03:13 PM|dlee00|LINK

    can anyone help me with a solution???

  • Re: How do I get IIS7 to compress json / asmx webservices?

    Nov 02, 2012 05:40 AM|eddymul|LINK

    Maybe you not installed the Dynamic Content Compression feature yet. 1. Go to: Turn Windows features on or off 2. Breakdown anc check: Internet Information Services -> World Wide Web Services -> Performance Features -> Dynamic Content Compression for Win 2008 you can refer to: http://blog.wassupy.com/2009/08/enabling-dynamic-http-compression-in.html

    IIS JSON

  • Re: How do I get IIS7 to compress json / asmx webservices?

    Dec 18, 2012 10:59 PM|yanuar|LINK

    I have a same problem with this, applicationHost.config has been modified and applicationPool has been recycled, iis server has been restarted, but all of them cannot solve this problem, there i miss something? anyone can help me too?