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

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

HTTP compression in IIS 7

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

 

Regards,

Wei Zhao

Comments (3)

  1. Alex says:

    Hey thanks! I was struggling with IIS7 static compression for hours till I found this post. Thanks!!

  2. nohairleft says:

    Facing a severe issue getting gzip encoding to work on IIS7.5:

    Using IIS 7.5, I have run the following commands:

    C:WindowsSystem32InetsrvAppcmd.exe set config -section:urlCompression -doStaticCompression:true -doDynamicCompression:true

    C:WindowsSystem32InetsrvAppcmd.exe set config -section:httpCompression -[name='gzip'].staticCompressionLevel:9 -[name='gzip'].dynamicCompressionLevel:4

    The cmd-window (with admin permissions) tells me that the commands were successfully implemented.

    Restarted IIS

    The problem is that the content-encoding header is not included in the server response despite the above. I tried putting in a custom http response header, but then the whole site fails with a "…incorrect encoding specified" error in the browser.

    Please help!!!

  3. Manoochehr says:

    Hi. Thanks for sharing your experience.

    I have the same problem. (IIS 7 Compression settings are OK but I get UNKNOWN_ERROR)

    In my case when I grant full permissions to USERS for C root (as you told), no change occurs.

    I also changed the Application pool Identity to LOCALSYSTEM but still no change.

    how can I get closer to the cause?

    Please give me a direction.

    Thanks in advance

Skip to main content