2016-09-29 96 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