我想用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: "d6af72bbcba8d21:0" 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开发工具中查看时,响应标头未显示Content-Encoding。
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任何想法为什么这不起作用
I'm wanting to serve a .js file with gzip compression
I'm using IIS 7.5 and have dynamic and static content compression enabled.
In the IIS logs I can see the following log which shows that it appears to be working as it shows "Content-Encoding: gzip" in the "GENERAL_RESPONSE_HEADERS" event
<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: "d6af72bbcba8d21:0" 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>However the response headers when viewed in Fiddler or Chrome dev tools are not showing Content-Encoding.
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 GMTAny ideas why this ain't working
最满意答案
修复:问题是我的机器上的防病毒软件正在剥离“Content-Encoding”响应标头。
Fixed: Issue was the antivirus on my machine was stripping out the "Content-Encoding" response header.
更多推荐
发布评论