错误1
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched
原因:文件夹的地址,和控制器地址不匹配,找不到视图。
文件夹: View/Home/Index.chtml
路由: controller/action -> Views/Home/Index.chtml
错误 2
The view at '~/Views/home/index.cshtml' must derive from WebViewPage, or WebViewPage<TModel>.
原因:视图页应继承WebViewPage或WebViewPage<TModel>
解决: Views文件夹下添加配置文件(web.config),在pages节点下继承WebViewPage。
错误3
[A]System.Web.WebPages.Razor.Configuration.HostSection 无法强制转换为 [B]System.Web.WebPages.Razor.Configuration.HostSection。类型 A 源自“System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”(在上下文“Default”中的“C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.WebPages.Razorv4.0_2.0.0.0__31bf3856ad364e35System.Web.WebPages.Razor.dll”位置处)。类型 B 源自“System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”(在上下文“Default”中的“C:UsersAdministratorAppDataLocalTempTemporary ASP.NET Files
ootd000c35856d9475aassemblydl3121dda4f77ffe24a_a9d1d001System.Web.WebPages.Razor.dll”位置处)
原因:
配置文件中的程序集版本和当前程序集的版本不匹配。
解决:
修改配置。