2010-08-22 4 views
4

'~/Areas/SomeArea/Views/List/Index.cshtml'의보기는 ViewPage, ViewPage, ViewUserControl 또는 ViewUserControl에서 파생되어야합니다.왜 ASP.NET MVC3 영역 및 면도기 뷰에서이 오류가 발생합니까?

프로젝트 구조는 대부분 기본값입니다. SomeArea라는 한 영역이 있습니다. List라는 단일 컨트롤러가 있습니다. 나는 부분 아무것도 도움을 보인다하여 전체 파일 부분을 비우는 시도

@inherits System.Web.Mvc.WebViewPage<dynamic> 

@{ 
    View.Title = "Index"; 
    LayoutPage = "~/Views/Shared/_Layout.cshtml"; 
} 

<h2>Index</h2> 

: 같은 뷰가 보이는

public ActionResult Index() 
{ 
    return View("~/Areas/SomeArea/Views/List/Index.cshtml"); 
} 

: 그것은 제외하고 아무것도하지 않는다. 내가 제어기를 만들고 그 영역 밖에서 볼 수 있다면 잘 작동합니다. 기본 면도기 뷰 엔진이 현재 영역을 지원하지 않을 수 있습니까?

편집 : 영역이 등록되었습니다.

public static void RegisterRoutes(RouteCollection routes) 
{ 
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 
    routes.MapRoute(
     "Default", // Route name 
     "{controller}/{action}/{id}", // URL with parameters 
     new { controller = "Random", action = "Index", id = UrlParameter.Optional } // Parameter defaults 
    ); 
} 

protected void Application_Start() 
{ 
    AreaRegistration.RegisterAllAreas(); 
    RegisterGlobalFilters(GlobalFilters.Filters); 
    RegisterRoutes(RouteTable.Routes); 
} 

public override void RegisterArea(AreaRegistrationContext context) 
{ 
    context.MapRoute(
     "SomeArea_default", 
     "SomeArea/{controller}/{action}/{id}", 
     new { controller = "List", action = "Index", id = UrlParameter.Optional } 
    ); 
} 

답변

관련 문제