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 have an AWS EC2 server windows 2008 R2 with IIS installed.
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."
We encountered this problem caused IIS Temporary Compressed Files which were corrupt/truncated due to the disk running out of space:
inetmgr
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
):
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With