IIS7 GZIP压缩 - httpCompression部分 [英] IIS7 GZIP Compression - httpCompression section

查看:163
本文介绍了IIS7 GZIP压缩 - httpCompression部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在IIS7上配置 httpCompression 。通过谷歌搜索,我发现它可以使用配置中的 httpCompression 部分进行。问题是,我无法通过web.config使其工作。

I trying to configure httpCompression on IIS7. By googling, I found that it can be made using httpCompression section in config. The problem, that I can't make it work from web.config.

当我在 applicationHost.config 中进行配置时,一切都按需要运行,但我希望能够每个应用程序的此配置而不是全局。

When I make the configuration in applicationHost.config everything works as needed, but I want to be able to make this configuration per application and not globally.

我将 applicationHost.config 中的部分定义更改为< section name =httpCompression overrideModeDefault =Allow/> 并将 httpCompression 部分移至web.config:

I changed section definition in applicationHost.config to <section name="httpCompression" overrideModeDefault="Allow" /> and moved httpCompression section to web.config:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/xaml+xml" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </staticTypes>
      <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="application/json; charset=utf-8" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
    </httpCompression>  

我缺少什么?看起来IIS根本没有从web.config读取压缩配置。

What am I missing? It looks like IIS not reads compression configurations from web.config at all.

每次更改后,我都会使应用程序池回收,所以这不是问题。

After each change, I make application pool recycle, so it not a problem.

推荐答案

你应该检查整个配置文件层次结构

如果您从 applicationHost 中删除​​了该部分,则可能是继承自 machine.config 或父目录的 web.config

If you removed the section from applicationHost you may be inheriting from machine.config or a web.config of a parent directory.

这篇关于IIS7 GZIP压缩 - httpCompression部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆