目前,我有我的Global.asax.cs
文件中的下列程序:當我調試ASP.NET MVC應用程序時,爲什麼不啓動Application_Start()事件?
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Arrangement", action = "Index", id = "" }
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
// Debugs the routes with Phil Haacks routing debugger (link below)
RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
}
Routing debugger ...
當我打F5
,應用火起來,除非我有一個名爲在~/Views/Home/
文件夾視圖Index.aspx
,雖然我重新定義了默認路由並刪除了HomeController
,但我收到了「View missing」錯誤消息。我希望得到路由調試器,如果不是,至少要求~/Views/Arrangement/Index.aspx
。
調試時從未命中RegisterRoutes(Routetable.Routes);
上的斷點。
我已經嘗試建設,重建,重新啓動VS,清洗,再次重建等,但似乎沒有工作。爲什麼應用程序不運行代碼的當前版本?
托馬斯,這是一個非常有趣的問題:)(+1) – 2009-06-09 16:08:25
您對網絡服務器的發展?檢查在IIS下運行的應用程序是否存在同樣的問題,然後使用新的空mvcapp? – 2009-06-09 19:29:35
在IIS上而不是在開發Web服務器上調試沒有幫助。在全新的MVC應用程序中,同一行上的斷點確實受到了打擊,所以我們可以將其縮小到特定項目的範圍。會是什麼呢? – 2009-06-09 22:27:02