Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I compress a Json result from ASP.NET MVC with IIS 7.5
    primarykey
    data
    text
    <p>I'm having difficulty making IIS 7 correctly compress a Json result from ASP.NET MVC. I've enabled static and dynamic compression in IIS. I can verify with Fiddler that normal text/html and similar records are compressed. Viewing the request, the accept-encoding gzip header is present. The response has the mimetype "application/json", but is not compressed.</p> <p>I've identified that the issue appears to relate to the MimeType. When I include <code>mimeType="*/*"</code>, I can see that the response is correctly gzipped. How can I get IIS to compress WITHOUT using a wildcard mimeType? I assume that this issue has something to do with the way that ASP.NET MVC generates content type headers.</p> <p>The CPU usage is well below the dynamic throttling threshold. When I examine the trace logs from IIS, I can see that it fails to compress due to not finding a matching mime type.</p> <pre><code>&lt;httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" noCompressionForProxies="false"&gt; &lt;scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /&gt; &lt;dynamicTypes&gt; &lt;add mimeType="text/*" enabled="true" /&gt; &lt;add mimeType="message/*" enabled="true" /&gt; &lt;add mimeType="application/x-javascript" enabled="true" /&gt; &lt;add mimeType="application/json" enabled="true" /&gt; &lt;/dynamicTypes&gt; &lt;staticTypes&gt; &lt;add mimeType="text/*" enabled="true" /&gt; &lt;add mimeType="message/*" enabled="true" /&gt; &lt;add mimeType="application/x-javascript" enabled="true" /&gt; &lt;add mimeType="application/atom+xml" enabled="true" /&gt; &lt;add mimeType="application/xaml+xml" enabled="true" /&gt; &lt;add mimeType="application/json" enabled="true" /&gt; &lt;/staticTypes&gt; &lt;/httpCompression&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload