我似乎无法为我的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
Run Code Online (Sandbox Code Playgroud)
对于压缩的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
Run Code Online (Sandbox Code Playgroud)
在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>
Run Code Online (Sandbox Code Playgroud)
在应用程序web.config中:
<urlCompression doStaticCompression="true" doDynamicCompression="true" …Run Code Online (Sandbox Code Playgroud) 每当我将此行添加到system.webServer部分中的web.config时:
<serverRuntime />
Run Code Online (Sandbox Code Playgroud)
使用我们没有属性,IIS 7.5只提供空白页面而不是网站.我使用IIS创建了一个新的空Web应用程序,并将该行添加到web.config; 空白页.
我究竟做错了什么?