주 MVC 프로젝트에서 내 지역에 대해 별도의 프로젝트를 설정하고 있습니다. 여기 가이드를 따라 :MVC 별도의 지역 프로젝트 -보기를 찾을 수 없습니다.
https://stackoverflow.com/a/12912161/155110
내가 발사하는 동안 중단 점을 설정하고 RazorGeneratorMvcStart이 경로를 설정하는 AreaRegistration뿐만 아니라 명중되고 있음을 볼 수 있습니다. RazorGenerator.Mvc가 설치되어 있고 cshtml 페이지의 사용자 정의 도구가이를 사용하도록 설정되어 있습니다. 내 메인 프로젝트를 시작한 후 Area URL에 액세스하면 별도의 Area 프로젝트에서 컨트롤러를 쳤다는 것을 알 수 있지만보기를 찾을 수는 없습니다.
[InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
STARAreaRegistration.cs
using System.Web.Mvc;
namespace AreaSTAR.Areas.STAR
{
public class STARAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "STAR";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"STAR_default",
"STAR/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
}
}
RazorGeneratorMvcStart.cs
using System.Web;
using System.Web.Mvc;
using System.Web.WebPages;
using RazorGenerator.Mvc;
[assembly: WebActivatorEx.PostApplicationStartMethod(typeof(AreaSTAR.RazorGeneratorMvcStart), "Start")]
namespace AreaSTAR {
public static class RazorGeneratorMvcStart {
public static void Start() {
var engine = new PrecompiledMvcEngine(typeof(RazorGeneratorMvcStart).Assembly) {
UsePhysicalViewsIfNewer = HttpContext.Current.Request.IsLocal
};
ViewEngines.Engines.Insert(0, engine);
// StartPage lookups are done by WebPages.
VirtualPathFactoryManager.RegisterVirtualPathFactory(engine);
}
}
}
지역/STAR/컨트롤러/DefaultController.cs
: 나는 어떤 큰 위치의 목록은 다음을 얻을using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace AreaSTAR.Areas.STAR.Controllers
{
public class DefaultController : Controller
{
// GET: STAR/Default
public ActionResult Index()
{
return View();
}
}
}
영역/S TAR /보기/기본/Index.cshtml : http://localhost:53992/STAR/Default/Index