2016-09-29 7 views
0

私はmvcアプリケーションで作業していて、ルートを解決して複数のコントローラが競合しています。コントローラーが1つしかなく、コントローラーを持つサイトに1つのdllがあります。これは大きなDLLであり、この1つのDLLには多くのコントローラがあります。他のMVCルートも正常に動作します。なぜこうなった?Routeにはコントローラが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() } 
); 

サンプルURLコール:

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

答えて

1

のみ可能何とかあなたがbinフォルダ内の重複するDLLを持つまで終了してもよいということです。あなたのプロジェクト名前空間の名前が変更されましたか?これにより、VS.NETが新しいアセンブリを生成し、古いアセンブリをbinフォルダに並べて残すためです。

binフォルダをクリーンアップしてください。再構築して試してみてください。

+0

私は思うでしょうね。私はビンを掃除した。しかし、この前後に存在していた領域があり、それらはすべて重複なしで動作します。 – kosmos

関連する問題