Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to fix err_content_decoding_failed when dynamic compressing?

I'm working on a ASP.Net website, and are currently optimizing it. I'm trying to enable dynamic content compression to it, but it won't work.

I get

Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.

  • On my development environment it works well.

    • I've built the project in release mode I've added the dynamic content compression module, enabled dynamic content compression and checked that this is what i receive.
  • I have an AWS EC2 server windows 2008 R2 with IIS installed.

    • I've built the project in release mode, and publish it to a folder, which i deploy to the server.
    • I've tried with the same web.config file as i have on the developer machine, but no luck there

Added this to web.config:

<httpCompression
    directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"
    dynamicCompressionDisableCpuUsage="90"
    dynamicCompressionEnableCpuUsage="80"
    maxDiskSpaceUsage="100" minFileSizeForComp="2700"
    noCompressionForRange="true"
    sendCacheHeaders="false"
    staticCompressionDisableCpuUsage="100"
    staticCompressionEnableCpuUsage="80"
    >
    <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="application/json" enabled="true" />
        <add mimeType="application/xml" 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="application/json" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/rss+xml" enabled="true" />
        <add mimeType="application/xaml+xml" enabled="true" />
        <add mimeType="application/xml" enabled="true" />
        <add mimeType="image/svg+xml" enabled="true" />
        <add mimeType="*/*" enabled="false" />
    </staticTypes>
</httpCompression>
<urlCompression doDynamicCompression="true" />

Anybody have an idea of what could be wrong?

Thanks in advance.

EDIT: Tried running the request through fiddler and got the response: "The content could not be decompressed.

The magic number in GZip header is not correct. Make sure you are passing in a GZip stream."

like image 968
Evi Avatar asked Feb 27 '13 12:02

Evi


Video Answer


2 Answers

We encountered this problem caused IIS Temporary Compressed Files which were corrupt/truncated due to the disk running out of space:

  1. Run inetmgr
  2. Go to the machine, Compression feature
  3. Delete the contents of the Cache directory
like image 172
Richard Dingwall Avatar answered Oct 05 '22 22:10

Richard Dingwall


A colleague of mine had this exact same problem.

He was running his application with a non-standard application pool identity. For the sake of this solution I will call that identity SomeOtherApplicationPoolIdentity.

The problem was that it was lacking permissions to a sub-folder in his cache directory (to see what cache directory IIS uses, go to the IIS Manager, click the top-level tree node, click on Compression; by default it is %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files):

enter image description here

Inside of %SystemDrive%\inetpub\temp\IIS Temporary Compressed Files, he was missing permissions for a sub-folder named, SomeOtherApplicationPoolIdentity, contextually named according to his application pool identity, so he just inherited permissions from the parent folder from that sub-folder and it worked, because the parent folder generally grants permissions to the IIS_IUSRS, SYSTEM, Administrators, and local administrative user account.

like image 23
Alexandru Avatar answered Oct 06 '22 00:10

Alexandru