IIS 7 压缩不起作用

发布于 2024-09-19 12:37:45 字数 237 浏览 1 评论 0原文

我有一个带有 IIS 7 的 Windows Server 2008 R2。

默认情况下,当您在 IIS 中创建站点时,会启用压缩。我检查了压缩模块,两个复选框都被选中。

现在,我使用 fiddler 检查页面是否正在被压缩,但似乎没有,因为选择了“无压缩”并且页面大小超过 100 KB。

即使在 IIS 7 中启用了压缩,为什么页面未压缩?

任何建议都将受到高度赞赏。

谢谢。

I have a Windows server 2008 R2 with IIS 7.

By default when you create a site in IIS, Compression is enabled. I checked the Compression module and both Checkboxes are checked.

Now, I am using fiddler to check if pages are being compressed but it seems they are not as the No Compression is selected and the page size is over 100 KB.

Why pages are Not compressing even though Compression is enabled in IIS 7 ?

Any suggestions will be highly appreciated.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

那伤。 2024-09-26 12:37:45

您的页面内容是动态的(即 .aspx 或 .php)吗?如果是,您的 IIS 是否安装了动态内容压缩模块?您可以通过查看“启用动态内容压缩”复选框来判断。如果显示为灰色,则表示未安装。

要安装它,请参考以下链接:

在 IIS7 中启用动态 HTTP 压缩Windows Server 2008

本质上,它说(有很多图片)您必须通过服务器管理器添加动态内容压缩角色服务,然后确保它在 IIS 管理器中启用。

Are your pages' content dynamic (i.e. .aspx or .php)? If so, does your IIS have the dynamic content compression module installed? You can tell by looking at the "Enable dynamic content compression" checkbox. If it is grayed out, then it is not installed.

To install it, please refer to the following link:

Enabling Dynamic HTTP Compression in IIS7 on Windows Server 2008

Essentially, it says (with lots of pictures) that you must add the Dynamic Content Compression role service through Server Manager, and then ensure that it is enabled in IIS Manager.

來不及說愛妳 2024-09-26 12:37:45

我找到了一个解决方案:-) 该解决方案始终提供压缩版本。

对我来说,在 IIS 7.5 管理器中,我选中了两个复选框,以便压缩两者:

  • 静态文件
  • 动态文件

有时(第一次提供网页),它是未压缩的。
然后,只有第二次,它才被压缩。

以下解决方案来自此处:
http://www.codeproject .com/Articles/242133/Making-the-most-out-of-IIS-compression-Part-conf

为了让 IIS 始终缓存压缩版本,而不是未压缩版本,请修改 applicationHost.config 文件。您通常会在文件夹 C:\Windows\System32\inetsrv\config 中找到此文件:

  1. 制作 applicationHost.config 的备份副本。
  2. 使用文本编辑器打开 applicationHost.config, - 或 -
    在 IIS 管理器中,导航到默认网站 >配置编辑器并转到“system.webServer/urlCompression”部分
  3. 找到该部分。
  4. dynamicCompressionBeforeCache="true" 属性添加到 urlCompression 元素,
  5. Collapse |复制代码
  6. 保存 applicationHost.config 文件
  7. 重置 IIS 服务器以使新属性生效
  8. 启动 IIS 管理器,单击树顶部的服务器,然后单击右侧的重新启动

我希望它会拯救您,因为它救了我!

I've come to a solution :-) This solution ALWAYS serves a compressed version.

For me too, in IIS 7.5 Manager, I have checked Both boxes, in order to compress both :

  • Static files
  • Dynamic files

Sometimes (the first-time a webpage is served), it is UNCOMPRESSED.
Then, only the second time, it is COMPRESSED.

The following solution comes from here :
http://www.codeproject.com/Articles/242133/Making-the-most-out-of-IIS-compression-Part-conf

In order to get IIS to ALWAYS cache the compressed version, rather than the uncompressed version, modify the applicationHost.config file. You'll normally find this file in the folder C:\Windows\System32\inetsrv\config:

  1. Make a backup copy of applicationHost.config.
  2. Open applicationHost.config with a text editor, — or —
    In IIS Manager, navigate to Default Website > Configuration Editor and go to the section "system.webServer/urlCompression"
  3. Find the section.
  4. Add the dynamicCompressionBeforeCache="true" attribute to the urlCompression element,
  5. Collapse | Copy Code

  6. Save the applicationHost.config file
  7. Reset the IIS server to make the new attribute take effect
  8. Start IIS Manager, click the server at the top of the tree, and then click Restart on the right-hand side

I Hope it will save your day, as it saved mine !

故事未完 2024-09-26 12:37:45

我们遇到了同样的问题,但使用的是 IIS8。关闭动态和静态压缩可以解决问题,但更改设置后需要重新启动 IIS。

We were experiencing the same issue, but with IIS8. Turning off Dynamic and Static compression did the trick, but you'll need to restart IIS after altering the setting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文