MVC5 Autofac:视图发现在未创建 [英] MVC5 Autofac: The view found at was not created

查看:452
本文介绍了MVC5 Autofac:视图发现在未创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造了非常简单的MVC 5.0应用程序,我推到GitHub的仓库: https://github.com/ marxin / MVC样本。我的动机是为了与单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:的https://github.com/marxin/mvc-sample/commit/ca980adcf1d67e2e74729b27b11c26065dd2567e

能否请你帮我什么是必须注册为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中引用的定义,请参阅以下差异:
https://github.com/marxin/mvc-sample/commit/3d5d7fef6f0284a96518852e0d892ca6205f5679

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:视图发现在未创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆