简体   繁体   English

gzip压缩无法与IIS 8.5一起使用

[英]gzip compression not working with IIS 8.5

I have a Server 2012 R2 box running IIS. 我有一个运行IIS的Server 2012 R2盒子。 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. 我的请求标题都显示为accept-encoding,但响应标头始终为Transfer-Encoding:chunked和Vary:Accept-Encoding。 The following steps have been performed to try to get gzip compression working: 已执行以下步骤以尝试使gzip压缩工作:

  1. Dynamic and Static compression have been enabled on each site and at the machine level 已在每个站点和计算机级别启用动态和静态压缩
  2. Both compression methods are installed from Server Manager 两种压缩方法均从服务器管理器安装
  3. Httpcompression and urlcompression nodes have been manually added to web.configs 已将httpcompression和urlcompression节点手动添加到web.configs
  4. Mime types are defined for compression Mime类型被定义用于压缩
  5. frequentHitThreshold has been set to 1, so all content should be compressed after the first attempt to access it frequentHitThreshold已设置为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. 我唯一的信息是代码DYNAMIC_COMPRESSION_NOT_SUCCESS,原因是1。

Here are the headers: 以下是标题:

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? 可以执行哪些其他步骤来使压缩工作?

Compression was working, but ESET Antivirus was doing its job of monitoring web traffic. 压缩工作正在进行,但ESET Antivirus正在监控网络流量。 This modified the response and I didn't get gzip content encoding as expected. 这修改了响应,我没有得到预期的gzip内容编码。 Disabling ESET and testing again showed that compression was functioning. 禁用ESET并再次测试表明压缩正在运行。

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

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