Http 压缩显示带有 Orchard cms 的乱码响应

Http compression showing garbled response with orchard cms

我在 Orchard CMS 1.10.1 中使用 Win 2012 和 IIS 8.5。数据库是 SQL CE。我正在尝试启用 http 压缩,并在通过 IIS 启用动态内容压缩后间歇性地收到奇怪的响应。

我在 orchard 应用程序的 web.config 中添加了这一行以启用 http 压缩:

<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/> 

页面有时显示如下:

当我没有收到这种奇怪的浏览器响应(在所有浏览器中都会发生)时,页面加载正常,甚至在该站点上测试 gzip 加密:https://www.giftofspeed.com/gzip-test/

设置

dynamicCompressionBeforeCache="false"

您得到乱码响应的原因与 Orchard.OutputCache 模块缓存响应有关,该响应已经被 gzip 压缩,然后当它提供缓存时,IIS 将 gzip 该响应一次再次浏览器不进行双重解压。

该标志用于 IIS 输出缓存,您没有使用它,因为 Orchard 具有出色的实现。因此,即使关闭该标志,它仍会在输出缓存之前进行压缩。