gzip压缩无法与IIS 8.5一起使用 [英] gzip compression not working with IIS 8.5
问题描述
我有一个运行IIS的Server 2012 R2。我已经尝试为在该盒子上运行的几个站点启用压缩,但我无法弄清楚它为什么不起作用。我的请求标头都显示了accept-encoding,但响应标头始终是Transfer-Encoding:chunked和Vary:Accept-Encoding。已执行以下步骤以尝试使gzip压缩工作:
I have a Server 2012 R2 box running IIS. I've tried enabling compression for several sites running on that box, but I can't figure out why it won't work. My request headers all show accept-encoding, but the response headers are always Transfer-Encoding:chunked and Vary:Accept-Encoding. The following steps have been performed to try to get gzip compression working:
- 已在每个站点和计算机上启用动态和静态压缩级别
- 两种压缩方法都是从服务器管理器安装的。
- Httpcompression和urlcompression节点已手动添加到web.configs
- 为压缩定义Mime类型
- frequentHitThreshold已设置为1,因此所有内容应在首次尝试访问后进行压缩
- Dynamic and Static compression have been enabled on each site and at the machine level
- Both compression methods are installed from Server Manager
- Httpcompression and urlcompression nodes have been manually added to web.configs
- Mime types are defined for compression
- frequentHitThreshold has been set to 1, so all content should be compressed after the first attempt to access it
已经进行了跟踪以了解为什么没有进行压缩。我唯一的信息是代码DYNAMIC_COMPRESSION_NOT_SUCCESS,原因为1.
A trace has been done to see why compression isn't occurring. The only information I have is the code DYNAMIC_COMPRESSION_NOT_SUCCESS with a reason of 1.
以下是标题:
GET http://redactedservername:8082/ HTTP/1.1
Host: redactedservername:8082
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36
DNT: 1
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: ASP.NET_SessionId=gnqovt55ggt22lycufudc0ns
`
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding
Date: Wed, 22 Jun 2016 14:00:57 GMT
Transfer-Encoding: chunked
可以执行哪些其他步骤来使压缩起作用?
What other steps can be performed to get compression to work?
推荐答案
压缩工作正常,但ESET Antivirus正在监控网络流量。这修改了响应,我没有按预期获得gzip内容编码。禁用ESET并再次测试表明压缩正在运行。
Compression was working, but ESET Antivirus was doing its job of monitoring web traffic. This modified the response and I didn't get gzip content encoding as expected. Disabling ESET and testing again showed that compression was functioning.
这篇关于gzip压缩无法与IIS 8.5一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!