Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Controllers with one Name in ASP.NET MVC 2

I receive the following error when trying to run my ASP.NET MVC application:

The request for 'Account' has found the following matching controllers: uqs.Controllers.Admin.AccountController MvcApplication1.Controllers.AccountController

I searched the project for MvcApplication1.Controllers.AccountController to remove it, but I can't find a match.

I try to registered a route to fix it:

 routes.MapRoute(
     "LogAccount", // Route name
     "{controller}/{action}/{id}", // URL with parameters
     new { controller = "Account", action = "LogOn", id = "" },
     new string[] { "uqs.Controllers.Admin" } // Parameter defaults
 );

but that didn't solve it.

Multiple types were found that match the controller named 'Account'.

How I can fix this problem?

like image 221
loviji Avatar asked Apr 13 '10 07:04

loviji


1 Answers

If you refactor your project and change the default Namespace and Assembly from "MVCApplication1" to "uqs", you may end up with 2 assemblies in your bin directory (the new one and the old one). You can get this error because the AccountController is in both assemblies.

Clean your bin directory of the old MVCApplication1.dll.

like image 190
Craig Celeste Avatar answered Nov 14 '22 08:11

Craig Celeste