2016-09-29 47 views
0

我正在使用mvc应用程序,并且在解决路由问题时遇到多个控制器冲突。只有一个控制器,并且在拥有控制器的站点中有一个dll。这是一个很大的DLL,并且在这个DLL中有很多控制器。其他MVC路线工作正常。这是为什么发生?路线认为有2个控制器。

我知道有2个具有相同名称的控制器应该是名称空间。我知道有一个新的和旧的DLL都会加载应用程序并导致冲突,这不是问题。 - Multiple types were found that match the controller named 'Home'

The request for 'Nelson' has found the following matching controllers: 
MyWebsite.Areas.Controllers.NelsonController 
MyWebsite.Areas.Controllers.NelsonController 

[InvalidOperationException: Multiple types were found that match the controller named 'Nelson'. This can happen if the route that services this request ('Nelson/NelsonGridView/{NelsonGVM}') 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 'Nelson' has found the following matching controllers: 
MyWebsite.Areas.Controllers.NelsonController 
MyWebsite.Areas.Controllers.NelsonController] 

//路线

context.MapRoute(
    "Nelson 603 Grid View", 
    "Nelson/NelsonGridView/{NelsonGVM}", 
    new { controller = this.AreaName, action = "NelsonGridView", NelsonGVM = new NelsonGVM() } 
); 

样品网址电话:

https://mysite/CR/Nelson/NelsonGridView/ 

回答

1

唯一的可能就是不知为何,你可能最后不得不在bin文件夹重复的DLL。你有没有机会重命名你的项目命名空间?因为这会触发VS.NET产生新的程序集,并将旧的程序集并排放在bin文件夹中。

请清理bin文件夹。重建并尝试它。

+0

是的,这就是我会想的。我清理垃圾箱。但是在这之前和之后都存在一些领域,他们都没有重复的工作。 – kosmos

相关问题