问题描述
我创造了非常简单的MVC 5.0应用程序,我推到GitHub的仓库:。我的动机是为了与单3.2.3在Linux上运行的应用程序。
I created very simple MVC 5.0 application that I push to GitHub repository: https://github.com/marxin/mvc-sample. My motivation is to execute app on Linux with mono 3.2.3.
我想补充Autofac的NuGet包(更多precisely 3.3.0),这对我来说工作正常。问题是,如果我添加Autofac.Mvc5集成包,剃须刀停止与以下错误工作:
I would like to add Autofac NuGet package (more precisely 3.3.0), that works fine for me. Problem is that if I add Autofac.Mvc5 integration package, Razor stops working with following error:
System.InvalidOperationException
The view found at '~/Views/Home/Index.cshtml' was not created.
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Web.Mvc.
Exception stack trace:
at System.Web.Mvc.BuildManagerCompiledView.Render (System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ViewResultBase.ExecuteResult (System.Web.Mvc.ControllerContext context) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (IList`1 filters, Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (IList`1 filters, Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000] in <filename unknown>:0
DIFF:的
能否请你帮我什么是必须注册为Autofac启用的Razor视图页所需的最低限度?
Could you please help me what's the necessary minimum that must be registered for Autofac to enable Razor view pages?
如果我尝试ASPX模板,一切工作正常。
If I try aspx template, all works fine.
感谢您,马丁
推荐答案
确定,问题是在web.config中引用的定义,请参阅以下差异:
的
OK, the problem was in web.config reference definition, please see following diff:https://github.com/marxin/mvc-sample/commit/3d5d7fef6f0284a96518852e0d892ca6205f5679
顺便说一句。 MVC5真的不兼容单声道,但也有将修复缺失的功能引入请求。
Btw. MVC5 is really not compatible with mono, but there are pull requests that will fix missing features.
感谢
这篇关于MVC5 Autofac:视图发现在未创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!