我正在使用Chrome扩展程序YSlow来测试我的网站性能。
我使用gzip在Compress组件上获得了F等级。
应该压缩发送15个纯文本组件:
http://localhost:21964/Content/custom/css/blog.css
http://localhost:21964/Content/custom/css/style.css
http://localhost:21964/Content/custom/css/socialize-bookmarks.css
http://localhost:21964/Content/custom/css/prettyPhoto.css
http://localhost:21964/Content/custom/css/flexslider.css
http://localhost:21964/Content/custom/css/colors/color-orange.css
http://localhost:21964/Content/sc2.css
http://localhost:21964/Content/custom/javascript/custom.js
http://localhost:21964/Content/custom/javascript/header.js
http://localhost:21964/Content/custom/javascript/twitter.js
http://localhost:21964/Content/custom/javascript/bra.photostream.js
http://localhost:21964/Content/custom/javascript/jquery.flexslider.js
http://localhost:21964/Content/custom/javascript/jquery.bpopup-0.7.0.min.js
http://localhost:21964/Content/custom/javascript/prettyPhoto.js
http://localhost:21964/css/colors/color-orange.css
压缩通过减少HTTP响应的大小来缩短响应时间。 Gzip是目前最流行和最有效的压缩方法,通常可将响应大小减少约70%。今天大约90%的互联网流量通过声称支持gzip的浏览器传播。
有一个类似的帖子here,但即使我按照这些步骤操作,它也不会压缩流量。
我已经完成的步骤:
web.config
:
<system.webServer>
...
<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/javascript" enabled="true"/>
<add mimeType="*/*" enabled="true"/>
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="*/*" enabled="true"/>
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
...
</system.webServer>
<system.webServer>
...
<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/javascript" enabled="true"/>
<add mimeType="*/*" enabled="true"/>
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="*/*" enabled="true"/>
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
...
</system.webServer>
我目前正在项目中使用Developer Server - &gt;网络 - &gt;服务器
答案 0 :(得分:2)
visual studio开发服务器(Cassini)不支持使用IIS或IIS Express进行gzip压缩。