我目前在线托管了两个不相关的MVC3项目.
一个工作正常,另一个不起作用,给我错误:
找到了多个匹配名为"Home"的控制器的类型.如果为此请求提供服务的路由('{controller}/{action}/{id}')未指定名称空间来搜索与请求匹配的控制器,则会发生这种情况.
如果是这种情况,请通过调用带有'namespaces'参数的'MapRoute'方法的重载来注册此路由.
我的主机工作方式是他给我FTP访问权限,在该文件夹中我有两个其他文件夹,一个用于我的每个应用程序.
ftpFolderA2/foo.com
ftpFolderA2/bar.com
foo.com工作正常,我将我的应用程序发布到我的本地文件系统然后FTP内容,它的工作原理.
当我上传并尝试运行bar.com时,上面的问题会触发并阻止我使用我的网站.所有foo.com仍然有效.
bar.com是否在ftpFolderA2内部的控制器中搜索,这就是为什么它会找到另一个HomeController?我怎么能告诉它只应该看看Controller文件夹呢?
事实:
有人可以证实这是问题吗?
我的项目有两个方面.现在,当我运行程序时,我收到此错误:
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:
BaseAdminMVC.Areas.BaseAdmin.Controllers.HomeController
BaseAdminMVC.Areas.TitomsAdmin.Controllers.HomeController
Run Code Online (Sandbox Code Playgroud)
我在这里找到了一些来源:多个控制器名称
但我认为它只适用于一个区域.
就我而言,我在不同领域有两个项目.希望有人能告诉我该怎么做才能解决问题.
这是Global.asax文件:
public static void RegisterRoutes(RouteCollection routes) …Run Code Online (Sandbox Code Playgroud)