title: Configuring IIS 7.5 to send JSON responses gzipped, NO_MATCHING_CONTENT_TYPE
body: <p>So I'm trying to get my app to send its JSON responses using dynamic compression and gzip.  Unfortunately this isn't working.  All the static compression on the server is working fine, but not dynamic.</p>
  
  <p>I've set this up by adding:</p>
  
  <pre><code>&lt;add mimeType="application/json" enabled="true" /&gt;
  &lt;add mimeType="application/json; charset=utf-8" enabled="true" /&gt;
  </code></pre>
  
  <p>To the <code>&lt;dynamicTypes&gt;</code> section of <code>&lt;httpCompression&gt;</code> in the applicationHost.config file.  I'm using Charles to inspect HTTP requests and I can verify that I'm sending the requests with the <code>Accept-Encoding: gzip, deflate</code> header set.  I've tried with both <code>Accept: */*</code> and <code>Accept: application/json</code>.  When it wasn't working I enabled 'Failed Request' trace logging to find the error code for <code>DYNAMIC_COMPRESSION_NOT_SUCCESS</code>, which was <code>NO_MATCHING_CONTENT_TYPE</code>.</p>
  
  <p>I've been trying to research on forums and Google, but all I can see is people saying that using the mimeType with the charset specified fixes the problem for them, but in my case it's still not working and I can verify that the response comes back with a header saying <code>Content-Type: application/json; charset=utf-8</code></p>
  
  <p>The endpoints that serve the JSON responses are standard .NET ASMX WebServices annotated with <code>[ScriptService()]</code> at the class and <code>[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]</code> at the method.  They return JSON fine, but I can't get the dynamic compression to work for the life of me.</p>
  
  <p>Since these are regular web methods as well I also added:</p>
  
  <pre><code>&lt;add mimeType="text/xml" enabled="true" /&gt;
  &lt;add mimeType="text/xml; charset=utf-8" enabled="true" /&gt;
  </code></pre>
  
  <p>To attempt to gzip the XML responses.  What's frustrating is that this compression works while sending JSON from the same method doesn't. At this point I'm kindof at a loss.</p>