iis7上的gzip http压缩问题
我的网络托管提供商正在运行 IIS7,但我在让 gzip 压缩正常工作方面遇到了很多麻烦。主机管理员说已安装压缩。我可以使用一些在线检查服务确认压缩,但不能使用其他服务。 PageSpeed Firefox 插件还表示该网站未压缩。我个人坐在 Squid 代理后面,但 web.config 设置应该解决代理问题。下面是相关的 web.config 片段。大部分都是从各个网站借来的。有什么想法吗?
<urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" doStaticCompression="true" />
<httpCompression cacheControlHeader="max-age=86400" noCompressionForHttp10="False" noCompressionForProxies="False" sendCacheHeaders="True" dynamicCompressionEnableCpuUsage="89" dynamicCompressionDisableCpuUsage="90" minFileSizeForComp="1" noCompressionForRange="False">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<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="*/*" enabled="false" />
</staticTypes>
</httpCompression>
My web hosting provider is running IIS7 and I am having loads of trouble to get gzip compression to work properly. Host admins say compression is installed. I can confirm compression using some online checking services but not with others. PageSpeed Firefox add-on also says the site is uncompressed. I am personally sitting behind a Squid proxy but web.config settings should take care of proxy issue. Below is the relevant web.config snippet. Most of it is borrowed from various sites. Any thoughts?
<urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" doStaticCompression="true" />
<httpCompression cacheControlHeader="max-age=86400" noCompressionForHttp10="False" noCompressionForProxies="False" sendCacheHeaders="True" dynamicCompressionEnableCpuUsage="89" dynamicCompressionDisableCpuUsage="90" minFileSizeForComp="1" noCompressionForRange="False">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<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="*/*" enabled="false" />
</staticTypes>
</httpCompression>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这篇文章大约有 4 个月了,但是你检查过 IIS 中是否启用了动态压缩吗?这里有一篇文章介绍如何做到这一点
http://blog.wassupy.com/2009/ 08/enabling-dynamic-http-compression-in.html
默认情况下 IIS 未启用它。可能值得尝试。
This post is about 4 months old, but have you checked if dynamic compression is enabled in IIS? There's an article here on how to do it
http://blog.wassupy.com/2009/08/enabling-dynamic-http-compression-in.html
By default IIS it isn't enabled. Might be worth trying.
尝试以下两个方法来解决此问题:
尝试遵循在 web.config 中设置布尔值的大小写标准并使用小写而不是 pascal 大小写。
如果您的主机允许,请尝试通过 IIS 连接到服务器上的站点,并检查压缩部分是否已锁定。
如果您的主机允许,请
Try two this towards resolving this issue:
Try following the case standard for setting booleans in the web.config and use lower case rather than pascal casing.
Try connecting to the site on the server via IIS if your host allows this and check the compression section to see if it is locked.