在IIS7中,gzip压缩文件不会保持这种状态 [英] In IIS7, gzipped files do not stay that way
问题描述
我已将IIS7配置为gzip静态内容。
I have configured IIS7 to gzip static content.
http://www.coderjournal.com/2008/04/iis-7-compress-javascript-gzip/
但是,文件不会保持gzip状态。
However, the files don't "stay" gzipped.
这是我的用例:
- 请求test.css文件。它不是gzip压缩。
- 请在几秒钟内再次申请。 是 gzip。
- 等待5分钟。
- 再次请求test.css文件。它不是gzip。
- Request test.css file. It is not gzipped.
- Request it again within a few seconds. It is gzipped.
- Wait 5 minutes.
- Request test.css file again. It is not gzipped.
这没有意义 - 不应该在所有的情况下传送一个静态文件的gzip压缩版本后续请求,如果原始版本没有改变?
This doesn't make sense -- shouldn't the gzipped version of a static file be delivered on all subsequent requests, if the original did not change?
注意:我使用Firefox和Firebug通过检查Content-Encoding标头验证gzip压缩内容。
Note: I am using Firefox and Firebug to verify gzipped content by checking the Content-Encoding header.
推荐答案
根据这篇文章:
在IIS7中,内容根据其命中频率进行压缩可配置如下:
In IIS7, content is compressed depending on it's hit frequency which is configurable like this:
<system.webServer>
<serverRuntime enabled="true"
frequentHitThreshold="5"
frequentHitTimePeriod="00:00:20" />
</system.webServer>
也许你没有达到这些门槛?
Maybe you're not hitting these thresholds?
这篇关于在IIS7中,gzip压缩文件不会保持这种状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!