Enable GZIP Compression Error: STATIC_COMPRESSION_NOT_SUCCESS

I am trying to enable gzip compression in IIS 7.5.

I think all the settings are fine.

In ApplicationHost.config, I have this httpCompression section:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" minFileSizeForComp="0"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <staticTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="application/atom+xml" enabled="true" /> <add mimeType="application/xaml+xml" enabled="true" /> </staticTypes> </httpCompression> 

And this urlCompression section:

 <urlCompression dostaticcompression="true" /> 

and here is the result of tracking a failed request:

  STATIC_COMPRESSION_NOT_SUCCESS Reason="UNKNOWN_ERROR" 
+4
source share
3 answers

The following configurations worked for me. Just replace the httpCompression section in the applicationHost.config file with the one below and restart IIS. What is it!!!

  <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" staticCompressionDisableCpuUsage="95" staticCompressionEnableCpuUsage="60" dynamicCompressionDisableCpuUsage="95" dynamicCompressionEnableCpuUsage="50"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" /> <dynamicTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="*/*" enabled="false" /> <add mimeType="application/json" enabled="true" /> <add mimeType="application/json; charset=utf-8" enabled="true" /> </dynamicTypes> <staticTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="application/atom+xml" enabled="true" /> <add mimeType="application/xaml+xml" enabled="true" /> <add mimeType="application/json" enabled="true" /> <add mimeType="application/json; charset=utf-8" enabled="true" /> <add mimeType="*/*" enabled="false" /> </staticTypes> </httpCompression> 

After setting this parameter, I received below headers in the response, which indicates that the data is compressed using gzip compression

 Cache-Control β†’ no-cache Content-Encoding β†’ gzip Content-Length β†’ 4202 Content-Type β†’ application/json; charset=utf-8 Date β†’ Wed, 22 Jul 2015 07:40:17 GMT Expires β†’ -1 Pragma β†’ no-cache Vary β†’ Accept-Encoding X-Powered-By β†’ ASP.NET 

The above configuration is for all IIS. If you want to configure this for one website, replace

 <section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Deny" /> 

with

 <section name="httpCompression" overrideModeDefault="Allow" /> 

in applicationHost.config and instead of replacing the httpCompression section in applicationHost.config, add it under the system.webServer tag in the web.config of your site.

Also, make sure you specify the correct MIME type for your data. In my case, it was in JSON, so I used below configuration

 <add mimeType="application/json" enabled="true" /> <add mimeType="application/json; charset=utf-8" enabled="true" /> 
+3
source

If I look at the web.config of the html5-templateplate project, it uses this method:

 <!-- GZip static file content. Overrides the server default which only compresses static files over 2700 bytes --> <httpCompression directory="%SystemDrive%\websites\_compressed" minFileSizeForComp="1024"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <staticTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/javascript" enabled="true" /> <add mimeType="application/json" enabled="true" /> <add mimeType="*/*" enabled="false" /> </staticTypes> </httpCompression> 

https://github.com/paulirish/html5-boilerplate-server-configs/blob/master/web.config

Perhaps this is the null value that you specified, or the path to the directory that you are using.

see also

0
source

I suggest checking that the application pool user account, if you have one, has certain full rights in the directory "%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"

0
source

All Articles