IIS 7 compression returns UNKNOWN_ERROR for static types

 

Recently, we have a problem about compression in IIS 7. IIS keeps returning un-compressed content even enabled compression for static types. If we look at the temp compression file folder (By default, it is C:\inetpub\temp\IIS Temporary Compressed Files\<application pool>), there is no compressed temp file there. From the FREB trace, static compression module returned error with “UNKNOW_ERROR”.

 

It works if we change the application pool identity to Local System account from Network Service. This turned out to be a permission issue. To find out the permission issue, we run process monitor which used to troubleshooting permission issue like NTFS and registry. Unfortunately, we don’t find any related problem by process monitor.

 

By live debugging, we finally find the root cause. A call to GetVolumeInformation API returned “Access Denied”, the static compression failed to initialize successfully. Checking C:\ root directory permission, we found only Local System and “Administrators” group have permission to access c:\ root directory. By default, “users” group should have “Read&Execute” permission for c:\ root directory. For this site, “users” group was removed as a part of security harden.

 

Resolution:

 

1. Grant “users” group “read&execute” permission to c:\

2. Change the compression temporary folder to another disk which “users” group has “Read&Execute” permission. The default folder is %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files.

Appcmd used to change the compression temporary folder.

C:\Windows\System32\inetsrv>appcmd set config /section:httpcompression /directory:'d:\temp compression folder'

 

Reference:

Changes to compression in IIS7

https://blogs.iis.net/ksingla/archive/2006/06/13/changes-to-compression-in-iis7.aspx

HTTP compression in IIS 7

https://www.iis.net/ConfigReference/system.webServer/httpCompression

 

Regards,

Wei Zhao