2012-10-10 23 views
0

在我Application_Start我有一個的RegisterRoutes方法,我稱之爲以下通話:C#MVC無法得到ignoreRoute工作(MiniProfiler仍顯示他們嗎?)

// Do not process any static files 
routes.IgnoreRoute(
    "{*staticfile}", new { staticfile = @".*\.(jpg|gif|jpeg|png|js|css|htm|html|htc)$" } 
); 

此外,我已經MiniProfiler配置我像下面這樣運行:

protected void Application_BeginRequest() 
    { 
     MiniProfiler.Start(); 

     var profiler = MiniProfiler.Current; 
     using (profiler.Step("Application_BeginRequest")) 
     { 
     } 
    } 

現在,當我啓動我的網站,我看到正在分析圖像:

MiniProfiler image

對我來說,這似乎表明我的IgnoreRoute工作不正常,或圖像應該從未達到MiniProfiler狀態。我在這裏是不正確的,還是我做錯了什麼?

回答

2

如果您正在運行在集成模式下的應用程序的所有請求都通過託管處理程序和的Application_BeginRequest甚至那些靜態資源被截獲。您對IgnoreRoute調用所做的是,您將它們從路由引擎中排除,並且它們不會被解析爲任何控制器操作。