zoukankan      html  css  js  c++  java
  • ASP.Net MVC3安全升级导致程序集从3.0.0.0变为3.0.0.1

    开发环境一般引用的是本机 C:Program Files (x86)Microsoft ASP.NETASP.NET MVC 3Assemblies下的System.Web.Mvc.dll,当系统更新时,此文件会更新为高级版本,从而和已经部署到服务器上的System.Web.Mvc.dll版本不一致。从能在线上运行时报下面的错误:

    Assembly 'TestUnsafe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

    发现没?System.Web.MVC的版本要求是3.0.0.1,而bin里放的仍然是3.0.0.0,肯定跑不起来。

    OK,换个新的程序集上去,把System.Web.MVC.dll 3.0.0.1版放上去,仍然跑不起来,报错:

    Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    这是由于Web.config未更新导致的,找到下面的几行:

      <runtime>    

     <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>  

    </assemblyBinding>

      </runtime>

    调整oldVersion和newVersion,改成:

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

    看到没?把旧版本的MVC统一映射到3.0.0.1版去。再访问站点,一切正常了。

  • 相关阅读:
    不允许使用邮箱名称。 服务器响应为: Mail from must equal authorized user
    SQL SERVER MD5
    c#转VB.NET
    SQL Sqlserver查询的安全性和性能的优化(转载)
    SQL Server 开发人员需要避免的八种习惯(TechTarget转载)
    索引维护对于保证查询能够总是受益于索引使用并减少 IO/RAM/CPU 是至关重要的
    SQL SERVER性能分析--死锁检测数据库阻塞语句
    怎样有效地跟踪SQL Server的阻塞问题?(网转)
    solr.net的使用
    利用HttpWebRequest实现实体对象的上传
  • 原文地址:https://www.cnblogs.com/tyhj-zxp/p/4766790.html
Copyright © 2011-2022 走看看