Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the gzip compression in asp.net

Tags:

Is there a way to set the gzip compression at the web.config level or can I only do this in the IIS management console?

like image 375
Micah Avatar asked Aug 24 '09 20:08

Micah


People also ask

How do I enable gzip compression in IIS?

Check the httpCompression TypesCheck the httpCompression section in applicationHost. config file, you should find <add mimeType="application/x-javascript" enabled="true" /> . If this is correct, then it should be correctly configured in your IIS. This will start compressing your .

How do I use gzip compression in web API?

Then use the following class at the method level as in the following: . Execute the Web API method by commenting the DeflateCompression attribute that is applied on the Web API controller method, you will find that returned data is not compressed but simple JSON. See the execution time when compression is not applied.


1 Answers

Here try this: Sped my site up by about 400% percent. Worked on first try.

Activate GZip with web.config

<system.webServer>   <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>   <urlCompression doStaticCompression="true" doDynamicCompression="true"/> </system.webServer> 
like image 68
brenjt Avatar answered Sep 19 '22 00:09

brenjt