Friday, 4 November 2016

ASP.NET: Enable Gzip compression via web config

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
  <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
  <dynamicTypes>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>
  </dynamicTypes>
  <staticTypes>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>
  </staticTypes>
</httpCompression>
 

Where to put:
Here is the position where you have to put the gzip settings in your web config: 





 
How to confirm:
You can verify whether gzip is working for you or not by looking at the response headers in console.  The Content-Encoding header will have gzip
 value there.
 
 
 

No comments:

Post a Comment