ASP.NET MVC页面报错System.InvalidOperationException The view found at '~/Views/Home/Index.cshtml' was not created.

时间:2021-09-26 07:33:19
Application Exception

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) [0x00061]
in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.ViewResultBase.ExecuteResult (System.Web.Mvc.ControllerContext context) [0x00080] in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x00000]
in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (System.Collections.Generic.IList`1[T] filters, System.Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x0000b]
in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive (System.Collections.Generic.IList`1[T] filters, System.Int32 filterIndex, System.Web.Mvc.ResultExecutingContext preContext, System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionResult actionResult) [0x0009b]
in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters (System.Web.Mvc.ControllerContext controllerContext, System.Collections.Generic.IList`1[T] filters, System.Web.Mvc.ActionResult actionResult) [0x0000a]
in <cc73190bab9d435c831510ff295c572a>:0 at System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass21+<>c__DisplayClass2b.<BeginInvokeAction>b__1c () [0x0008a] in <cc73190bab9d435c831510ff295c572a>:0

解决办法:这可能是因为Web服务器部署环境中缺少了类库System.Web.WebPages.Deployment.dll

当然,造成这个错误的原因很多,这只是一种解决办法,供参考。