Why does not the Application_Start() event fire when I debug my ASP.NET MVC app?

后端 未结 12 1478
独厮守ぢ
独厮守ぢ 2021-01-30 16:01

I currently have the following routines in my Global.asax.cs file:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRout         


        
12条回答
  •  北恋
    北恋 (楼主)
    2021-01-30 16:18

    In my case the problem was between chair and keyboard - after renaming mvc project assembly, I forgot to update Global.asax to point to the correct class. So check the "Inherits" in Global.asax (in visual studio right-click on Global.asax -> View Markup)

    <%@ Application Codebehind="Global.asax.cs" 
      Inherits="Monster.MgsMvc.Web.MvcApplication" 
      Language="C#" %>
    

    if it really matches your Global.asax.cs class/namespace declaration

提交回复
热议问题