AreaRegistration.RegisterAllAreas() is not Registering Rules For Area

大憨熊 提交于 2019-11-28 08:38:58

I think due to Visual Studio's caching, some of the dll's aren't compiled properly and this situation can happen. If you do, delete all temp files from following locations:

  • C:\Temp
  • C:\Users\%Username%\AppData\Local\Microsoft\VisualStudio
  • C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
  • C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
  • Path\To\Your\Project\obj\Debug

Update :

  • AppData\Local\Temp\Temporary ASP.NET Files

Then restart the Visual Studio. This is how i resolved.

cnabilou

Just add the namespace of your controllers to the AreaRegistration:

public override void RegisterArea(AreaRegistrationContext context)
    {
        context.MapRoute(
            "Admin_default",
            "Admin/{controller}/{action}/{id}",
            new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            **namespaces: new string[] { "Web.Admin.Controllers" }**
        );
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!