• MVC3迁移MVC4相关问题


    mvc3迁移到mvc4后,发布到服务器,出现了如下错误:

    [A]System.Web.WebPages.Razor.Configuration.RazorPagesSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.RazorPagesSection. Type A From"System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"(In the context of"Default"In the"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.WebPages.Razorv4.0_1.0.0.0__31bf3856ad364e35System.Web.WebPages.Razor.dll"Position). Type B From"System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"(In the context of"Default"In the"C:WindowsMicrosoft.NetassemblyGAC_MSILSystem.Web.WebPages.Razorv4.0_2.0.0.0__31bf3856ad364e35System.Web.WebPages.Razor.dll"Position).

    看原因,可能是GAC程序集和当前程序集冲突的缘故,遂修改节点如下,添加了Syste.Web.WebPages.Razor的节点:

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0"/>
          </dependentAssembly>
    
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="1.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>

    之后,注释掉web.config中所有的关于ext.net的节点配置。重新编译,启动服务器,正常运行。

  • 相关阅读:
    [TCP/IP] HTTPS的工作原理
    [TCP/IP] SSL的通讯原理
    ESLint笔记
    MacBook Pro维修过程
    论前端工程化
    听书,怅然若失
    js实现Mac触摸板双指事件(上/下/左/右/放大/缩小)
    Windows和Mac浏览器启动本地程序
    科目三(番禺化龙展贸东路)考试录20170224
    写jQuery插件该注意的
  • 原文地址:https://www.cnblogs.com/scy251147/p/3818475.html
Copyright © 2020-2023  润新知