title: ASP.Net vs ASP.Net Core compression & IIS
body: <p>I have developed the same application which delivers a JSON file in 2 different projects. One is based on ASP.Net MVC4 and the other is based on ASP.Net Core 1.1.0.
  The JSON generated by my controller is around 5MB.</p>
  
  <p>However when publishing the 2 apps, i have a difference of sizes for this file if it is compressed or not on both plateforms.</p>
  
  <p>For ASP.Net Core, I have also tried to enable the compression middleware in the Startup.cs to see the difference:</p>
  
  <pre><code>    services.AddResponseCompression(
          options =&gt;
              options.MimeTypes = ResponseCompressionMimeTypes.Defaults);
  
      app.UseResponseCompression()
         .UseStaticFiles();
  </code></pre>
  
  <p>This is the summary of my tests for my original 5Mo JSON returned to the client:</p>
  
  <p>Run on Visual Studio, size of my JSON on:</p>
  
  <ul>
  <li><p>MVC4: 5MB </p></li>
  <li><p>ASP.Net Core default: 1.3MB</p></li>
  <li><p>ASP.Net core with compression: 869KB</p></li>
  </ul>
  
  <p>On my local IIS Express with dynamic and static compression enabled,  size of my JSON on:</p>
  
  <ul>
  <li><p>MVC4: 256KB </p></li>
  <li><p>ASP.Net Core default: 1.3MB</p></li>
  <li><p>ASP.Net core with compression: 869KB</p></li>
  </ul>
  
  <p>On my production IIS server with dynamic and static compression enabled,  size of my JSON on:</p>
  
  <ul>
  <li><p>MVC4: 136KB </p></li>
  <li><p>ASP.Net Core default: 675KB</p></li>
  <li><p>ASP.Net core with compression: 869KB</p></li>
  </ul>
  
  <p>So we can see that for MVC4, we go from a not compressed file to a highly compressed file in production.</p>
  
  <p>For ASP.Net Core, when the compression is enabled in the Startup.cs, the size of the file is constant but not as small as it could be.</p>
  
  <p>For ASP.Net Core, when the compression is not enabled in Startup.cs, the file is gzip by default but I am not sure it is using the compression capabilities of the IIS server.</p>
  
  <p>My question is what could I do to obtain a compressed JSON in ASP.Net Core as small as the one I obtained on my older plateform based on MVC4.</p>
  
  <p>Thank you</p>
  
  <p>Sylvain</p>