zoukankan      html  css  js  c++  java
  • 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的节点配置。重新编译,启动服务器,正常运行。

  • 相关阅读:
    JAVA HttpsURLConnection 忽略对SSL valid 的验证
    IntellJ 13.x JPA Persistence Sample
    IntelliJ IDEA 13.x 下使用Hibernate + Spring MVC + JBoss 7.1.1
    Entity Framework + WCF REST JSON Service
    WCF Membership and Role Provider
    ASP.NET MVC 4 SimpleMembership Provider (1)
    Centos7下安装Nginx
    Centos7下部署docker
    centos 6.5将系统语言改为中文
    ensp配置DHCP实例
  • 原文地址:https://www.cnblogs.com/scy251147/p/3818475.html
Copyright © 2011-2022 走看看