命名空间的变化 - 被发现多种类型相匹配的控制器命名为'家'了 [英] Namespace change - Multiple types were found that match the controller named 'Home'

查看:197
本文介绍了命名空间的变化 - 被发现多种类型相匹配的控制器命名为'家'了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了以下问题改变了命名空间为我的MVC项目后:

I ran into the following problem after changing the namespace for my mvc project:

多种类型的发现命名为'家'控制器匹配。这可能发生,如果该服务此请求('{控制器} / {行动} / {ID}')没有指定的命名空间的路线以搜索一个控制器的请求相匹配。如果是这种情况,通过调用'图路线的方法,需要一个命名空间参数的重载寄存器该路由。

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:

oldns .Controllers.HomeController

oldns.Controllers.HomeController

newns .Controllers.HomeController

newns.Controllers.HomeController

有关于这个错误的其它回答问题,但包括其他原因:

There are other answered questions about this error, but cover other causes:

  • Multiple projects
  • Areas

推荐答案

之后做一些研究,我发现,原因是留在bin文件夹老MVC应用程序的DLL(BIN \\ oldns.dll)。清理不清理出来。我手动删除bin目录的内容,然后一切都很好。

After doing some research, I found that the cause was the old mvc app dll remaining in the bin folder (bin\oldns.dll). Clean was not clearing it out. I manually deleted the contents of the bin directory and then all was well.

这篇关于命名空间的变化 - 被发现多种类型相匹配的控制器命名为'家'了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆