我似乎无法让我的ASP.NET 4应用程序启用GZIP压缩.只有
javascript文件似乎被压缩.该页面,css等不会压缩.
未压缩的CSS文件的响应头是:
Content-Type text/css Last-Modified Mon,09 Aug 2010 20:10:34 GMT Accept-Ranges bytes Etag "5d71bdecfe37cb1:0" Server Microsoft-IIS/7.5 Date Sat,28 Aug 2010 14:33:56 GMT Content-Length 3364
而对于一个被压缩的Javascript文件(scriptresource.axd):
Cache-Control public Content-Type application/x-javascript Content-Encoding gzip Expires Sun,28 Aug 2011 14:33:50 GMT Last-Modified Sat,28 Aug 2010 14:33:50 GMT Server Microsoft-IIS/7.5 Date Sat,28 Aug 2010 14:33:56 GMT Content-Length 478
在applicationHost.config中:
<httpCompression sendCacheHeaders="false" directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files" noCompressionForRange="true"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <staticTypes> </staticTypes> <dynamicTypes> </dynamicTypes> </httpCompression>
并在应用程序web.config中:
<urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true" /> <httpCompression noCompressionForRange="false" noCompressionForHttp10="false" noCompressionForProxies="false" > <dynamicTypes> <add mimeType="text/css" enabled="true" /> </dynamicTypes> <staticTypes> <add mimeType="text/css" enabled="true" /> </staticTypes> </httpCompression>
有谁能告诉我什么设置我失踪了?