How do I compress a Json result from ASP.NET MVC with IIS 7.5

Make sure your %WinDir%\System32\inetsrv\config\applicationHost.config contains these:

<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>

From the link of @AtanasKorchev.

As @simon_weaver said in the comments, you might be editing the wrong file with a 32 bit editor on a 64 bit Windows, use notepad.exe to make sure this file is indeed modified.


I have successfully used the approach highlighted here.


Use this guide

None of these answers worked for me. I did take note of the application/json; charset=utf-8 mime-type though.


I recommend this approach
Create CompressAttribute class, and set target action.