窗口更新打破了MVC应用程序 [英] Window Update Broke MVC Application

查看:321
本文介绍了窗口更新打破了MVC应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我跑Windows Update和它的时候我试图释放我的ASP.NET MVC 4项目的新版本引入了一些问题。

I ran Windows Update yesterday and its introduced some problems when I'm trying to release a new version of my ASP.NET MVC 4 project.

应用程序编译,当我推的版本为什么要在我的网络服务器的测试现场将其与错误信息跌幅超不过还好在本地运行,

The application compiles and runs okay locally, however when I push the version up to a test-site on my webserver it fell over with the error message:

System.Web.HttpCompileException: (0): error CS1705: Assembly 'App_Code, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

经过一番研究,我发现,这是由于从4.0.0.0至4.0.0.1更新。我从我的项目中删除System.Web.Mvc DLL并重新添加具有新版本的DLL。同样在当地的一切而不是工作在网络上。然后,我通过在web.config的就去改变4.0.0.0任何提及到4.0.0.1。同样,这将继续内部工作,但外部失败。错误消息是:

After some research I found that this is due to an update from 4.0.0.0 to 4.0.0.1. I removed the System.Web.Mvc dll from my project and readded the dll that has the later version. Again everything works locally but not on the web. I then went through the web.config's and changed any mention of 4.0.0.0 to 4.0.0.1. Likewise this continues to work internally but fails externally. The error message is:

    
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) 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileLoadException: 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)

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

我相信这事做与我使用了错误处理ELMAH。

I believe this has something to do with Elmah that I'm using for the error handling.

我试图从的NuGet重新安装如下建议:<一href=\"http://stackoverflow.com/questions/26393157/windows-update-caused-mvc3-and-mvc4-stop-working\">Windows更新造成MVC3和MVC4停止工作但是这并没有工作,我得到了同样的错误。

I tried to reinstall from Nuget as suggested here: Windows update caused MVC3 and MVC4 stop working but that hasn't worked and I'm getting the same error.

补充信息:
该服务器尚未更新,我担心更新,这可能打破现有的现场版。

Added info: The server hasn't yet been updated, I'm concerned that updating this might break the existing live version.

推荐答案

该错误信息是告诉我,你已经在你的配置文件中的一个指定了MVC装配了不正确的版本号。发现它的版本不正确的配置文件并改变它来匹配您正在使用的任何版本(你上面提到的4.0.0.1)。你需要检查的所有的的配置文件,包括

The error message is telling me that you have specified an incorrect version number for the MVC assembly in one of your config files. Find it the config file with the incorrect version and change it to match whatever version you are using (you mentioned 4.0.0.1 above). You need to check all the config files including


  • 一个在项目的根

  • 的一个在浏览文件夹

您也可以做一个组装重定向在配置文件来照顾这个问题,以及 - 如果它的第三方因失败的lib这可能是最适当的行动采取

You could also do an assembly redirect in your config file to take care of this as well -- If its failing due to a third party lib this might be the most appropriate action to take.

根据您的反馈ID建议使用绑定重定向。添加到您的web.config主..

Based on your feedback id suggest using a binding redirect. Add this to your main web.config..

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

这篇关于窗口更新打破了MVC应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆