加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows-server-2008 – GZip压缩在IIS 7.5上无效

发布时间:2020-12-14 00:01:20 所属栏目:Windows 来源:网络整理
导读:我试图支持IIS下的静态文件的GZip压缩(默认情况下应该启用但不能)但到目前为止还没有工作.这是 system.webServer下的部分. web应用程序的web.config文件中的节点; httpCompression directory="%SystemDrive%inetpubtempIIS Temporary Compressed Files" s
我试图支持IIS下的静态文件的GZip压缩(默认情况下应该启用但不能)但到目前为止还没有工作.这是< system.webServer>下的部分. web应用程序的web.config文件中的节点;
<httpCompression directory="%SystemDrive%inetpubtempIIS Temporary Compressed Files">
  <scheme name="gzip" dll="%Windir%system32inetsrvgzip.dll" staticCompressionLevel="9" />
  <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="*/*" enabled="false" />
  </dynamicTypes>
  <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>
</httpCompression>

<urlCompression doStaticCompression="true" />

我尝试使用谷歌浏览器.这是请求标题;

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3

Accept-Encoding:gzip,deflate,sdch

Accept-Language:en-US,en;q=0.8

Cache-Control:no-cache

Connection:keep-alive

Host:my-website-url

Pragma:no-cache

User-Agent:Mozilla/5.0 (Windows NT 6.0) AppleWebKit/534.30 (KHTML,
like Gecko) Chrome/12.0.742.122 Safari/534.30

这些是响应标题;

Accept-Ranges:bytes

Content-Length:232651

Content-Type:application/x-javascript

Date:Thu,04 Aug 2011 08:58:19 GMT

ETag:”a69135734a50cc1:0″

Last-Modified:Mon,01 Aug 2011 12:56:37 GMT

Server:Microsoft-IIS/7.5

X-Powered-By:ASP.NET

我检查了applicationHost.config文件,发现了一些如下节点;

----

<section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />

----

<section name="urlCompression" overrideModeDefault="Allow" />

----

<httpCompression directory="%SystemDrive%inetpubtempIIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%system32inetsrvgzip.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>
</httpCompression>

----

<urlCompression />

我在这里想念的是什么?

您可能没有在临时压缩文件夹上正确设置权限.您需要确保IIS安装(或应用程序)正在运行的用户具有对压缩文件夹的写入权限.

More here

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读