Asp.net mvc MVC独立区域项目-找不到视图

Asp.net mvc MVC独立区域项目-找不到视图,asp.net-mvc,razor,asp.net-mvc-areas,Asp.net Mvc,Razor,Asp.net Mvc Areas,我正在我的主要MVC项目中为我的领域建立单独的项目。我跟随导游来到这里: 我在启动期间设置了断点,可以看到RazorGeneratorMvcStart以及设置路由的区域注册正在被命中。安装了RazoGenerator.Mvc,并且我的cshtml页面上的自定义工具设置为使用它。当我在启动主项目后访问区域URL时,我可以看到它击中了单独区域项目中的控制器,但是,我无法让它找到视图。我得到了一个巨大的位置列表: [InvalidOperationException:视图“索引”或其主视图不可用 “

我正在我的主要MVC项目中为我的领域建立单独的项目。我跟随导游来到这里:

我在启动期间设置了断点,可以看到RazorGeneratorMvcStart以及设置路由的区域注册正在被命中。安装了RazoGenerator.Mvc,并且我的cshtml页面上的自定义工具设置为使用它。当我在启动主项目后访问区域URL时,我可以看到它击中了单独区域项目中的控制器,但是,我无法让它找到视图。我得到了一个巨大的位置列表:

[InvalidOperationException:视图“索引”或其主视图不可用 “找到”或“没有”视图引擎支持搜索的位置 搜索地点:

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/Controllers/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();
        }
    }
}
区域/STAR/Views/Default/Index.cshtml:

@* Generator: MvcView *@

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>View1</title>
</head>
<body>
    <div>
        Index view
    </div>
</body>
</html>
@*生成器:MvcView*@
@{
布局=空;
}
视图1
索引视图

看到视图未找到时访问的URL错误:

这是因为我意外安装了RazorEngine.Generator扩展,并将自定义工具设置为RazorenginGenerator,而不是安装Razer Generator扩展并将自定义工具设置为RazorGenerator