GZIP无法在" text / html" mimeType的 80 端口工作,但其他类型的GZIP正常。 所以我试图将端口更改为其他端口,例如 808或其他任何人,一切都变得正确。所有mimiTypes都包括" text / html" GZIP很好。
80端口响应标头:
text / html 无法gzip
Cache-Control:private
Content-Length:2469
Content-Type:text/html; charset=utf-8
text / css 或其他任何类型正常工作
Accept-Ranges:bytes
Content-Encoding:gzip
Content-Length:1550
Content-Type:text/css
808端口响应标头:
所有类型包括 text / html 工作GZIP罚款:
Cache-Control:private
Content-Encoding:gzip //became work fine!
Content-Length:1452
Content-Type:text/html; charset=utf-8
Accept-Ranges:bytes
Content-Encoding:gzip // work fine like before
Content-Length:1550
Content-Type:text/css
1. 环境:asp.net mvc 2.0 + iis7.5 + windows2008 R2。
2. IIS配置:启用动态内容和静态内容压缩,根网站(我的意思是IIS树中的根节点) ,对不起,我不知道如何用英语称呼它和目标网站。
3. 根网站:%systemroot%\ System32 \ inetsrv \ config \ applicationHost \ applicationHost.config :
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" doDiskSpaceLimiting="false" minFileSizeForComp="0">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
4.target site&#39; Web.config :也在mimeType上面打开:
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="application/json; q=0.5" enabled="true" />
<add mimeType="application/json; charset=utf-8" enabled="true" />
<add mimeType="application/json; q=0.5; charset=utf-8" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
解决方案参考: asp.net mvc - some files are not gzipped http://www.iis.net/configreference/system.webserver/httpcompression
如何让GZIP在80端口上运行 text / html ?