MVC报错:找到多个与名为“Home”的控制器匹配的类型。

错误原因是:在根目录中的Controller中有HomeController,而在Areas中也有一个HomeController,只是他们的命名空间不一样。

这样的话,只需要在对应的路由注册中加入命名空间就好了。

App_Start/RouteConfig.cs中 和 Areas/xxxAreaRegistration.cs中,

加上:namespaces: new[] { "xxxxxx.WebSiteForMVC.Areas.Sys.Controllers" }

指定命名空间。

原文地址:https://www.cnblogs.com/xsj1989/p/8676237.html