首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >当我调试我的ASP.NET MVC应用程序时,为什么Application_Start()事件不触发?

当我调试我的ASP.NET MVC应用程序时,为什么Application_Start()事件不触发?
EN

Stack Overflow用户
提问于 2009-06-09 01:51:22
回答 9查看 50.7K关注 0票数 72

目前,我的Global.asax.cs文件中有以下例程:

代码语言:javascript
复制
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的视图,否则我会收到"View missing“错误消息,尽管我已经重新定义了默认路由并删除了HomeController。我希望得到路由调试器,如果没有,至少会有一个~/Views/Arrangement/Index.aspx请求。

RegisterRoutes(Routetable.Routes);上的断点在调试时永远不会命中。

我尝试过构建、重建、重启VS、清理、重新重建等等,但似乎都不起作用。为什么应用程序不运行当前版本的代码?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/967813

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档