The view 'Index' or its master was not found.

后端 未结 17 2225
逝去的感伤
逝去的感伤 2020-12-15 14:42
The view \'Index\' or its master was not found. The following locations were searched:
~/Views/ControllerName/Index.aspx
~/Views/ControllerName/Index.ascx
~/Views/Sh         


        
17条回答
  •  臣服心动
    2020-12-15 15:25

    Check the generated code at MyAreaAreaRegistration.cs and make sure that the controller parameter is set to your default controller, otherwise the controller will be called bot for some reason ASP.NET MVC won't search for the views at the area folder

    public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "SomeArea_default",
                "SomeArea/{controller}/{action}/{id}",
                new { controller = "SomeController", action = "Index", id = UrlParameter.Optional }
            );
        }
    

提交回复
热议问题