zoukankan      html  css  js  c++  java
  • 自己搭建MVC时遇到的一些问题及解决办法

    错误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”位置处)
     
    原因:
    配置文件中的程序集版本和当前程序集的版本不匹配。
     
     
    解决:
    修改配置。
  • 相关阅读:
    6-2 对象克隆
    5-2 equal getClass or instanceOf
    6-2 回调
    6-1 接口的默认方法
    认识ExtJS(05)--
    认识ExtJS(04)--常见Web框架的ExtJS改造
    MyEclipse快捷键全
    ExtJS4.1自带API打不开的问题解决
    浅析十三种常用的数据挖掘的技术&五个免费开源的数据挖掘软件
    C++ 多态
  • 原文地址:https://www.cnblogs.com/simple-blog/p/4713440.html
Copyright © 2011-2022 走看看