开发环境一般引用的是本机 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. Apache配置文件服务器

    配置Apache文件服务器: apache配置文件服务器httpd.conf中这两个模块必须不被注释LoadModule autoindex_module modules/mod_autoindex. ...

  2. Win8.1安装Visual Studio 2015提示需要KB2919355

    http://www.microsoft.com/zh-cn/download/details.aspx?id=42335 安装说明: 1.若要开始下载,请单击“下载”按钮,然后执行以下操作之一,或者 ...

  3. ThrottleAttribute

    /// <summary> /// Decorates any MVC route that needs to have client requests limited by time. ...

  4. Sublime Text

    今天在网上找了个Sublime Text 3 Build 3065 的 license key .在最新的Build 3083 下可以使用,记录下. ----- BEGIN LICENSE ----- ...

  5. Mono 异步加载数据更新主线程

    主要是用 async和 await 调用 RunOnUiThread来更新. 调用函数: //异步加载数据开始 doInBackground (); //异步加载数据开始end protected a ...

  6. fgtyn

    http://www.studiocleo.com/projects/ballettechnique/one_11.html

  7. Python Quick list dir

    昨天 Python释放了 3.5 ,添加了 os.scandir 根据文档该API比os.listdir快Docs which speeds it up by 3-5 times on POSIX s ...

  8. socket模块的getaddrinfo方法详解

    getaddrinfo方法用于通过url解析dns import sys,socket def dns_resolver(url): result = socket.getaddrinfo(url, ...

  9. Echart图表入门

    1.Echart是什么? Enterprise Charts的缩写,商业级数据图表,一个纯Javascript的图表库.更多的内容可以参考网上的资料 2.使用步骤 a.下载开发包 官网地址:http: ...

  10. sublime 工具构建

    1 Sublime Text 3 配置react语法校验 原文地址:https://segmentfault.com/a/1190000004369542?_ea=585496 终端安装 npm in ...