IIS 7.5 does not compress JSON when installed in web.config application

I worked on enabling JSON compression from one of our MVC3 sites. From the various articles I've read, it seems that I can set the application/json; charset=utf-8MIME type in the web.config application file. But compression is not allowed. But when it is added to the applicationhost.config file, it works. Did I miss something?

In my web.config application, the following has been added:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
    <dynamicTypes>
        <add mimeType="application/javascript; charset=utf-8" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="application/json; charset=utf-8" enabled="true" />
    </dynamicTypes>
    <staticTypes>
        <add mimeType="application/javascript; charset=utf-8" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="application/json; charset=utf-8" enabled="true" />
    </staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />

The server is running Windows Server 2008 R2 with IIS7.5. I also installed and enabled dynamic compression for this site.

Any help would be greatly appreciated as I do not want to enable JSON compression for the entire server.

+5
source share
1 answer
Section

HttpCompression AppHostOnly ApplicationHost.config, web.config.

"ApplicationHost.config", , ( appcmd overrideModeDefault="Allow"), .

+10

All Articles