Search code examples
iisasp.net-web-apiasp.net-web-api2gziphttp-compression

ASP.NET Web Api2: Should we enable JSON data compression or not?


I read that json is not by default compressed through IIS while other files like html, cshtml, aspx are compressed.

Why IIS doesn't compress json by default using its gzip compression? If we do it manually, does that involve any risk?


Solution

  • You are right, by default the compression is not enabled for JSON. You need to change the IIS configuration to enable it.

    I don’t find any issue if you have good CPU to support it. But it will definitely help in reducing your pay load by a big number. This will give a better user experience even on lower bandwidth to your user.