本文介绍了命名空间更改 - 找到与名为“Home"的控制器匹配的多种类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在更改我的 mvc 项目的命名空间后遇到了以下问题:

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

找到了与名为Home"的控制器匹配的多种类型.如果服务此请求的路由 ('{controller}/{action}/{id}') 未指定命名空间来搜索与请求匹配的控制器,则可能会发生这种情况.如果是这种情况,请通过调用采用namespaces"参数的MapRoute"方法的重载来注册此路由.

Home"的请求找到了以下匹配的控制器:

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:

推荐答案

经过一番研究,我发现原因是bin文件夹(binoldns.dll)中残留了旧的mvc app dll.清洁并没有清除它.我手动删除了bin目录的内容,然后就一切正常了.

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

这篇关于命名空间更改 - 找到与名为“Home"的控制器匹配的多种类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!