开发环境一般引用的是本机 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. Windows系统

    1. 更改XP登录界面 怎样启用XP的经典登录界面 第一步:用管理员账号登录系统. 第二步:运行gpedit.msc启动组策略编辑器,找到"计算机配置"--"管理模板&q ...

  2. ADVDAV驱动

    // ADV7179 register configuration array for PAL mode ADI_DEV_ACCESS_REGISTER ADV7179_Cfg[]={ {ADV717 ...

  3. VS 远程调试之 “The visual studio remote debugger does not support this edition of windows”

    The error message "The visual studio remote debugger does not support this edition of windows&q ...

  4. Installing Intellij IDEA sublime-text-2 on Ubuntu

    he installation on Linux is traditionally more complicated. I wonder why people complain about the l ...

  5. Android Studio 修改字体

    修改字体(font)大小(size)   本文引用: http://blog.csdn.net/caroline_wendy/article/details/21876727   Android St ...

  6. Android的各种Drawable 讲解 大全

    Android把可绘制的对象抽象为Drawable,不同的图形图像资源就代表着不同的drawable类型.Android FrameWork提供了一些具体的Drawable实现,通常在代码中都不会直接 ...

  7. 如何为datagridview加上序号

    最简单的方法是在Datagridview的事件RowPostPaint事件下面添加如下代码即可 private void dataGridView1_RowPostPaint(object sende ...

  8. Notepad++的xml文本格式化

    1.需要使用插件 2.使用插件

  9. session的常用方法。

    void setAttribute(String attribute, Object value) 设置Session属性.value参数可以为任何Java Object.通常为Java Bean.v ...

  10. docker理念:不可变基础设施

    不可变基础设施 1.什么是Immutable Infrastructure Immutable Infrastructure,直译过来就是不可变基础设施. 它是由Chad Fowler于2013年提出 ...