开发环境一般引用的是本机 C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies下的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版去。再访问站点,一切正常了。

ASP.Net MVC3安全升级导致程序集从3.0.0.0变为3.0.0.1的更多相关文章

  1. ASP.NET MVC3升级到ASP.NET MVC4 的方法

    ASP.NET MVC3升级 ASP.NET MVC4 的方法: 1.先去掉引用的System.Web.Mvc.dll(MVC3版本),重新引入System.Web.Mvc.dll(MVC4版本) 2 ...

  2. Asp.Net MVC安全更新MS14-059导致项目编译失败

    微软最近一次安全更新MS14-059(链接:https://technet.microsoft.com/en-us/library/security/ms14-059)由于直接应用到了machine. ...

  3. ASP.NET MVC3的学习

    ASP.NET MVC第一次课(2013-12-25晚学完)     1.ASP.NET MVC 的特点       分离任务          可扩展        强大的URL重写(路由)机制   ...

  4. ASP.NET MVC3入门教程之第一个WEB应用程序

    本文转载自:http://www.youarebug.com/forum.php?mod=viewthread&tid=91&extra=page%3D1 上一节,我们已经搭建好了AS ...

  5. 经典ASP.NET MVC3.0入门详解

    http://blog.csdn.net/csh624366188/article/details/7064269 :由于本文原在word文档里编写,写本文章时运用了大量截图,直接复制到博客里,没有显 ...

  6. ASP.NET MVC3 系列教程 - 部署你的WEB应用到IIS 6.0

    I:ASP.NET MVC3 部署的前期工作 1.确认部署的服务器操作系统环境 首先我们确认服务器的操作系统版本 可以从系统命令行工具里输入: systeminfo 获取相关操作系统信息例如 然后再确 ...

  7. ASP.NET MVC3快速入门——第四节、添加一个模型

    在本节中我们将追加一些类来管理数据库中的电影.这些类将成为我们的MVC应用程序中的“模型”部分.我们将使用一个.NET Framework的被称之为“Entiry Framework”的数据访问技术来 ...

  8. Mono和Jexus并且部署ASP.NET MVC3、4、5和WebApi

    Linux(CentOS 6.7)下配置Mono和Jexus并且部署ASP.NET MVC3.4.5和WebApi(跨平台) 1.开篇说明 a. 首先我在写这篇博客之前,已经在自己本地配置了mono和 ...

  9. ASP.NET MVC3 入门指南之数据验证[源码RAR下载]

    http://www.cnblogs.com/BingoLee/archive/2011/12/23/2298822.html 前言: 无论你编写什么样的网页程序,都需要对用户的数据进行验证,以确数据 ...

随机推荐

  1. 利用Continuous Testing实现Eclipse环境自动单元测试

    当你Eclipse环境中修改项目中的某个方法时,你可能由于各种原因没有运行单元测试,结果代码提交,悲剧就可能随之而来. 所幸infinitest(http://infinitest.github.io ...

  2. ODAC学习地址

    http://www.cnblogs.com/ChinaEHR/p/4471920.html

  3. FPGA低级建模---按键去抖动

    FPGA低级建模,原则上一个模块一个功能,如按键去抖动建模中,有两个模块. 1.detect_module 这个是按键检测模块,主要检测按键的高低电平变化,现在按键是按下还是释放. 2.delay_m ...

  4. Aop资料整理

    1.Spring AOP 实现机制2 http://cjhz.iteye.com/blog/2245161 http://itindex.net/detail/29812-aop 2.跟我学aspec ...

  5. HttpContextBase转换成HttpContext对象

    有以下方法: 主要是方式就是通过context获取HttpApplication,然后通过Application获取相应的HttpContext ①HttpContext context=HttpCo ...

  6. 转载-------makefile 使用总结

    转载自:http://www.cnblogs.com/wang_yb/p/3990952.html 1. Makefile 简介 Makefile 是和 make 命令一起配合使用的. 很多大型项目的 ...

  7. iOS 代码控制iPhone&iPad旋转

      在APPDelegate中添加如下代码     p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo } p.p2 { margin ...

  8. loaded the "ViewController" nib but the view outlet was not set.'

    错误代码: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[U ...

  9. ps基础知识

    一 1. ps常用快捷键:ctrl+d 结束选区    ctrl+alt+z  返回          ctrl+z 撤销           ctrl+x 剪切 ctrl+t 编辑图片    ctr ...

  10. Mbps、Kbps、bps、MB、KB

    1:运营商带宽衡量单位: Mbps:百万位每秒 kbps:千位每秒 bps:位每秒 b:bit,比特 1Mbps=1000kbps=1,000,000bps 这些单位通常用来表示每秒传输的二进制位 2 ...