0

I have to rename my project as per my team lead.Say from Prj1 to Prj

So as in the process I have changed namespace too.But now I am getting following error on project run.

System.InvalidOperationException: Multiple types were found that match the controller named 'Account'. This can happen if the route that services this request ('{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 'Account' has found the following matching controllers:
prj_Track.Controllers.AccountController
prj1_Track.Controllers.AccountController
   at System.Web.Mvc.DefaultControllerFactory.GetControllerTypeWithinNamespaces(RouteBase route, String controllerName, HashSet`1 namespaces)
   at System.Web.Mvc.DefaultControllerFactory.GetControllerType(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.DefaultControllerFactory.System.Web.Mvc.IControllerFactory.GetControllerSessionBehavior(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcRouteHandler.GetSessionStateBehavior(RequestContext requestContext)
   at System.Web.Mvc.MvcRouteHandler.GetHttpHandler(RequestContext requestContext)
   at System.Web.Mvc.MvcRouteHandler.System.Web.Routing.IRouteHandler.GetHttpHandler(RequestContext requestContext)
   at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context)
   at System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

So I guess the rename of namespace was not proper. Steps are
1. (shift + ctl + h) and replace
2. prj properties -> default namespace && assembly name

Any help will be appreciated

Robert_Junior
  • 1,122
  • 1
  • 18
  • 40
  • Clean your solution. Probably an old assembly. – CodeCaster Jun 04 '15 at 11:51
  • Still have the issue – Robert_Junior Jun 04 '15 at 11:52
  • Can you post code raised an error? Is it in `routes.MapRoute` ? – General-Doomer Jun 04 '15 at 11:53
  • 1
    You're not really helping. Is the old assembly in your bin directory? Does a "Find in Files" (for example using Notepad++) reveal any other files mentioning an `AccountController`? Does it work if you check the source out in a new directory and compile it there? – CodeCaster Jun 04 '15 at 11:54
  • 1
    @CodeCaster thank you so much. Both dlls were present in Bin. – Robert_Junior Jun 04 '15 at 11:57
  • You're welcome. See duplicate, especially [this comment which mentions exactly the same issue](http://stackoverflow.com/questions/5092589/having-issue-with-multiple-controllers-of-the-same-name-in-my-project#comment24984167_15651619). – CodeCaster Jun 04 '15 at 12:00

0 Answers0