I'm trying to enable dynamic compression for the mime type application/json
.
In applicationHost.config, I've made the following change:
<section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Allow" />
I also tried unlocking the section with the following command:
appcmd unlock config /section:system.webserver/httpcompression
My web.config settings (same as applicationHost.config but with additional mimetype):
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
</httpCompression>
But the response is not being gzipped. I know the settings are correct as it works if I add the mimetype directly to applicationHost.config.
I've enabled Failed Request Tracing and no errors are produced.
Best Answer
Try also adding the mime type: