Multiple types were found that match the controller Error in ASP.NET MVC

Published on April 21, 2013 by abundantcode

Filed under ASP.NET

Last modified April 21, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 4023 times

There are times when you get the error similar to the below message when you type the URL

“Multiple types were found that match the controller named ‘Employee’. This can happen if the route that services this request (‘Abundantcode/{controller}/{action}/{id}’) does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the ‘MapRoute’ method that takes a ‘namespaces’ parameter.

The request for ‘Employee’ has found the following matching controllers:

MvcApplication1.Controllers.EmployeeController

MvcApplication2.Controllers.EmployeeController”

Multiple types were found that match the controller Error in ASP.NET MVC

If the above error message is observed, it clearly states that the reason for the error is the Multiple Controller Name and Action Method defined in different Namespaces.

One way to resolve this error is to make sure that the controller name is unique. The other simple option is to specify the preference of the Namespace to be used in the MapRoute method of the RouteConfig file.

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment


x

You might be Interested in these Posts

How to return Json instead of XML in ASP.NET Web API ?

When you make a call to the ASP.NET Web API action method and notice this in Google Chrome browser ,...

How to Add Web API to existing ASP.NET Web Forms Project ?

In one of the previous posts , we saw how to add the WebAPI to the existing ASP.NET MVC project. Wel...

How to Add Web API to existing ASP.NET MVC Project ?

There are times when you might want to add Web API project to one of your existing ASP.NET MVC proje...