我创建了一个模块化的MVC项目来在同一个运行时加载其他特殊的Web项目.
其他项目位于名为"模块"的网站根目录下的文件夹中.我正在使用属性PreApplicationStartMethod 在启动时加载子目录中的其他程序集.
我添加了特殊的路由来定位具有命名空间约束的每个模块.
我创建了一个实现RazorViewEngine的类,当对模块中的元素进行调用时覆盖viewPath:〜/ Views/Home/Index.cshtml - >〜/ Modules/ModuleTest/Views/Home/Index.cshtml.
成功调用动态加载库中的Index()方法,但在呈现视图时出现错误:
见下图:http://i.imgur.com/KoTgxg2.png
框架告诉我基本上已找到视图但他不会渲染它.有谁知道为什么框架拒绝渲染它?
'/'应用程序中的服务器错误.
未创建在'〜/ Modules/ModuleTest/Views/Home/Index.cshtml'中找到的视图.
描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.
异常详细信息:System.InvalidOperationException:未创建在"〜/ Modules/ModuleTest/Views/Home/Index.cshtml"中找到的视图.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: The view found at '~/Modules/ModuleTest/Views/Home/Index.cshtml' was not created.] System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +362 …