简体   繁体   English

IIS Gzip压缩拒绝工作

[英]IIS Gzip compression refuses to work

I've looked at every question on this site regarding this issue but none of the solutions worked for me! 我已经查看了该站点上有关此问题的每个问题,但没有一个解决方案对我有用! I know I must be missing something small, but I just can't find it. 我知道我一定想念一些小东西,但是我找不到。

I'm using windows 7 and IIS 7.5. 我正在使用Windows 7和IIS 7.5。 So I've added the following to the system applicationHost.config : 因此,我将以下内容添加到系统applicationHost.config

 <section name="httpCompression" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />

I've installed Static and dynamic compression and enabled them for the site. 我已经安装了静态和动态压缩,并为站点启用了它们。 And added the following to my web.config 并将以下内容添加到我的web.config

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

But still it does not work. 但是它仍然不起作用。 I tried FailedReqLog module to debug this issue but no log files are created. 我尝试了FailedReqLog模块来调试此问题,但未创建任何日志文件。 I can't even see httpCompression in my configuration editor in IIS. 我什httpCompression在IIS的配置编辑器中都看不到httpCompression 在此处输入图片说明

I've been trying different solutions for the past 3 days. 在过去的3天里,我一直在尝试不同的解决方案。 I'm totally out of ideas. 我完全没有主意。 Debugging options are most appreciated if there is a way to trace this issue and see why could it possibly not be following the web.config setting. 如果有一种方法可以跟踪此问题并查看为什么它可能不遵循web.config设置,则最好使用调试选项。 Even worse why is it not showing it in the configuration editor. 更糟糕的是为什么它不在配置编辑器中显示。

By default on IIS 7.5, if the file size is less than 2,700 KB then compression will not be used. 在IIS 7.5上,默认情况下,如果文件大小小于2700 KB,则将不使用压缩。 Another exclusion is by CPU utilization. 另一个排除是CPU使用率。 By default, if CPU utilization is over 90%, compression will not be used. 默认情况下,如果CPU利用率超过90%,将不使用压缩。

Since this is on your development box, maybe your file sizes are too small. 由于这在您的开发箱中,因此文件大小可能太小。 You can change the defaults. 您可以更改默认值。

Reference IIS HTTP Compression . 参考IIS HTTP压缩

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM