これは多分重複しているかもしれませんが、明らかな答えが私の問題を解決するわけではありません。「Home」というコントローラに一致する複数のタイプが見つかりました。 (2つのエリア、同じコントローラ名)
私が手:
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:
App.Web.Controllers.HomeController
App.Web.Areas.Mobile.Controllers.HomeController
私はGlobal.ascx.csの私にHomeControllerのデフォルトの名前空間を設定しました:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
new string[] { "App.Web.Controllers.HomeController" }
);
は(App.Web.Controllers.HomeControllerがないことを確認済みタイプミス)。
もMobileAreaRegistrationにMobileのにHomeControllerを登録:
したがってpublic override void RegisterArea(AreaRegistrationContext context) {
context.MapRoute(
"Mobile_default",
"Mobile/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
、なぜそれが、私はまだエラーメッセージが表示されることありますか?私はビルド/クリーニングして再度実行しました。それでも同じ結果。
これは私が私のルートを登録する方法である:明白な理由のためのあなたのGlobal.asaxルート登録で
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
どのような順序でルートを登録しますか?あなたは完全な登録コードを表示することができますか? – Jan