开发者

Renaming namespace in ASP.NET MVC Project: compile OK, Running not OK

开发者 https://www.devze.com 2023-02-19 03:12 出处:网络
How to fix ? Multiple types were found that match the controller named \'Home\'. This can happen if the route that services this request (\'{controller}/{action}/{id}\') does not specify namespaces t

How to fix ?

Multiple types were found that match the controller named 'Home'. 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 'Home' has found the following matching controllers: MyProject1.Controllers.HomeControlle开发者_开发技巧r MyProject2.Controllers.HomeController


Probably need a little bit more details. For e.g. Did you change the namespace from MyProject1 to MyProject2?

Check your bin folder to see if any of dlls from the old namespace are still around. If that's the case cleaning them up and recompiling should fix the issue.


Make sure you edit the default namespace setting in your web project properties, on the Application tab.


I assume this is in your Views. Be certain the namespaces in your views is correct.

0

精彩评论

暂无评论...
验证码 换一张
取 消