What is wrong with my area routing in my bin deployed MVC4 app?

后端 未结 5 1916
我在风中等你
我在风中等你 2021-01-13 04:36

I have just deployed an MVC4 .NET 4.0 app to my web host, for \'live\' deployed testing. Non -area routes are working fine, e.g. my

@Html.ActionLink(\"Regis         


        
5条回答
  •  無奈伤痛
    2021-01-13 05:05

    In your global.asax.cs make sure you have this line in your Application_Start:

    AreaRegistration.RegisterAllAreas();
    

    In each area, you should have AreaRegistration.cs something like this:

    public class testAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "test";
            }
        }
    
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "test_default",
                "test/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
            );
        }
    }
    

提交回复
热议问题