2009-06-16 45 views
2

在YSlow的帮助下,我试着调整我的页面。
我认为,为了获得巨大收益,压缩我的页面是一件小事。 尝试从here,here,herehere之后的所有内容YSlow仍然显示我的页面被压缩。为什么我的网页仍未被压缩?

我在IIS6上使用asp.net mvc 1.0。

在我的global.asax中有以下规则,我确保我的静态内容不被MVC处理。

routes.Clear(); 
// Turns off the unnecessary file exists check 
routes.RouteExistingFiles = true; 
// Ignore text, html, files. 
routes.IgnoreRoute("{file}.txt"); 
routes.IgnoreRoute("{file}.htm"); 
routes.IgnoreRoute("{file}.html"); 
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 
// Ignore the content directory which contains images, js, css & html 
routes.IgnoreRoute("Content/{*pathInfo}"); 
//Exclude favicon (google toolbar request gif file as fav icon which is weird) 
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.([iI][cC][oO]|[gG][iI][fF])(/.*)?" }); 

这将确保我的js和css文件是静态可访问的。

这些都是我的metabase.xml相关剪

<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/deflate" 
     HcCompressionDll="%windir%\system32\inetsrv\gzip.dll" 
     HcCreateFlags="0" 
     HcDoDynamicCompression="TRUE" 
     HcDoOnDemandCompression="TRUE" 
     HcDoStaticCompression="TRUE" 
     HcDynamicCompressionLevel="9" 
     HcFileExtensions="htm 
      html 
      txt 
      css 
      js 
      mvc" 
     HcOnDemandCompLevel="10" 
     HcPriority="1" 
     HcScriptFileExtensions="asp 
      dll 
      exe" 
    > 
</IIsCompressionScheme> 

<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/gzip" 
     HcCompressionDll="%windir%\system32\inetsrv\gzip.dll" 
     HcCreateFlags="1" 
     HcDoDynamicCompression="TRUE" 
     HcDoOnDemandCompression="TRUE" 
     HcDoStaticCompression="TRUE" 
     HcDynamicCompressionLevel="9" 
     HcFileExtensions="htm 
      html 
      txt 
      css 
      js 
      mvc" 
     HcOnDemandCompLevel="10" 
     HcPriority="1" 
     HcScriptFileExtensions="asp 
      dll 
      exe" 
    > 
</IIsCompressionScheme> 

(元:不知道我是否应该把这个对SO或SF)

+0

我不确定RO是什么? – AnthonyWJones 2009-06-16 07:30:52

+0

机架溢出,堆栈溢出的IT姊妹站点。我一直忘记它真的叫什么。 – 2009-06-16 07:44:37

回答

4

的问题是,压缩扩展相关,您需要指定应该获得静态或动态压缩的所有扩展。您可以通过分别查看HcFileExtensions和HcScriptFileExtensions属性来看到这一点。

因此,对于MVC而言,如果你不需要文件扩展名,你就不会获得动态内容的任何压缩。由于IIS7使用mimeTypes列表来触发压缩,因此IIS7执行的操作有所不同。带有集成管道的IIS7是我们真正希望放置MVC应用程序的地方。在IIS6中,它的可能性,但它的一个kludge和压缩是伤亡之一。

编辑

对于记住,压缩发生在一个单独的线程,并触发后的第一个请求到资源上IIS6熊静态内容,第一个请求本身熄灭压缩。随后使用压缩版本提供对资源的后续请求。

相关问题