IIS压缩缺少内容编码作为响应,即使日志显示它正常工作

时间:2017-03-30 00:59:22

标签: asp.net iis http-headers window webserver

我想用gzip压缩来提供.js文件

我正在使用IIS 7.5并启用了动态和静态内容压缩。

在IIS日志中,我可以看到以下日志,它显示它似乎正在工作,因为它在“GENERAL_RESPONSE_HEADERS”事件中显示“Content-Encoding:gzip”

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
 <System>
  <Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
  <EventID>0</EventID>
  <Version>1</Version>
  <Level>4</Level>
  <Opcode>47</Opcode>
  <Keywords>0x0</Keywords>
  <TimeCreated SystemTime="2017-03-29T23:40:41.555Z"/>
  <Correlation ActivityID="{8000000D-0003-FA00-B63F-84710C7967BB}"/>
  <Execution ProcessID="12296" ThreadID="13868"/>
  <Computer>AUD64909W0</Computer>
 </System>
 <EventData>
  <Data Name="ContextId">{8000000D-0003-FA00-B63F-84710C7967BB}</Data>
  <Data Name="Headers">Transfer-Encoding: chunked
Content-Type: application/javascript
Content-Encoding: gzip
Last-Modified: Wed, 29 Mar 2017 20:33:32 GMT
Accept-Ranges: bytes
ETag: &quot;d6af72bbcba8d21:0&quot;
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
</Data>
 </EventData>
 <RenderingInfo Culture="en-NZ">
  <Opcode>GENERAL_RESPONSE_HEADERS</Opcode>
 </RenderingInfo>
 <ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
  <EventGuid>{D42CF7EF-DE92-473E-8B6C-621EA663113A}</EventGuid>
 </ExtendedTracingInfo>
</Event>

但是,在Fiddler或Chrome开发工具中查看时,响应标头未显示内容编码。

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/javascript
Last-Modified: Wed, 29 Mar 2017 20:33:32 GMT
Accept-Ranges: bytes
ETag: "d6af72bbcba8d21:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Thu, 30 Mar 2017 00:57:20 GMT

为什么这不起作用的任何想法

1 个答案:

答案 0 :(得分:2)

修正:问题是我的机器上的防病毒软件正在剥离“Content-Encoding”响应标头。