나는 2 개의 다른 지역을 가진 asp.net mvc 프로젝트를 가지고있다.지정된 영역에서 asp.net mvc 프로젝트 실행
여기 아래 RouteConfig.cs 내 코드입니다.
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces:new[]{"Sample1.Controllers"}
);
내가 실행할 때 Sample1을 기본 프로젝트로 보거나 그 반대로하고 싶습니다. 하지만 그것은 내가 아래에 명시된 오류를 준다.
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:AreaSample.Areas.Sample1.Controllers.HomeController AreaSample.Areas.Sample2.Controllers.HomeController
지정한 네임 스페이스가 작동하지 않습니다. 또한 Sample1AreaRegistration.cs와 비슷합니다.
context.MapRoute(
"Sample1_default",
"Sample1/{controller}/{action}/{id}",
new { controller="Home", action = "Index", id = UrlParameter.Optional }
);
어떻게 문제를 해결할 수 있습니까?
답장을 보내 주셔서 감사합니다. 그러나 나는 당신의 첫번째 문제를 이해하지 못합니다. 또한 두 번째 배포 때문에 나를 위해 작동하지 않습니다. 실제로 RouteConfig.cs를 변경하면 아무 문제없이 배포하려는 영역이 기본 프로젝트가 될 수 있기를 원합니다. – Bora