码迷,mamicode.com
首页 > Web开发 > 详细

MVC3迁移MVC4相关问题

时间:2014-07-03 06:23:43      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:style   http   width   os   art   问题   

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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0.0__31bf3856ad364e35\System.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:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.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的节点配置。重新编译,启动服务器,正常运行。

MVC3迁移MVC4相关问题,布布扣,bubuko.com

MVC3迁移MVC4相关问题

标签:style   http   width   os   art   问题   

原文地址:http://www.cnblogs.com/scy251147/p/3818475.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!