MVC应用程序10月15日的Windows升级后突破 [英] MVC Applications break after Windows update of Oct 15

查看:152
本文介绍了MVC应用程序10月15日的Windows升级后突破的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天早上我醒来的时候发现,我的服务器上我的MVC 4 Web应用程序坏了。

This morning I woke up discovering that my MVC 4 web application on my server had broken.

错误消息是:

An exception of type 'System.IO.FileNotFoundException' occurred in 
mscorlib.dll but was not handled in user code.
Additional information: Could not load file or assembly 
'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, 
PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. 
The system cannot find the file specified.

我睁开VS项目,并从code(所以在不同的计算机上)跑了,发生了同样的错误!

I opened my VS project and ran it from code (so on a different computer), same error occurred!

我检查了我的服务器日志,发现更新已经在上午05时06分自动安装。其中一个更新是由安装程序包AspNetMVC4.msi完成。一分钟后,我的web应用程序的第一个错误开始流。

I checked my server log and discovered updates were automatically installed at 5:06 AM. One of the updates was done by an installer package AspNetMVC4.msi. One minute later, the first errors on my web application began streaming in.

在我的笔记本电脑的发展,相同的安装程序已经运行(10月15日),在下午一时10分10秒。

On my development laptop, the same installer had run yesterday (Oct 15) at 1:10:10 PM.

在两台计算机上相同的问题。

Same problem on both computers.

我从来没有听说过Newtonsoft.Json的(不过现在我发现它是什么)。它看起来好像MVC的DLL(不太可能)或封装的DLL(更可能)之一,人们必须Newtonsoft的参考。

I had never heard of Newtonsoft.Json (but now I found out what it is). It looks as if one of the MVC dlls (unlikely) or one of the package dlls (more likely) has a reference to Newtonsoft.

我试图从的NuGet intall Newtonsoft。这确实有一定的效果,从FileNotFound改为FileLoadException错误:

I have tried to intall Newtonsoft from nuget. This did have some effect, the error changed from FileNotFound to a FileLoadException:

An exception of type 'System.IO.FileLoadException' occurred in 
mscorlib.dll but was not handled in user code Additional
information: Could not load file or assembly 'Newtonsoft.Json,   
Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 
or one of its dependencies. The located assembly's manifest 
definition does not match the assembly reference. (Exception 
from HRESULT: 0x80131040)

我也试图从.NET 4.5升级到4.5.1。这并没有帮助。

I also tried to upgrade from .NET 4.5 to 4.5.1. That did not help.

顺便说一句,在出现的RegisterRoutes在Global.asax.cs中的错误:

BTW, the error occurs in RegisterRoutes in Global.asax.cs:

routes.MapHttpRoute( 
    name: "DefaultApi",
    routeTemplate: "api/{controller}/{id}",
    defaults: new { id = RouteParameter.Optional }
);

任何想法?

推荐答案

感谢所有为你的好想法!
我曾试图做组装重定向,但没有奏效。

Thanks all for your good thoughts! I had tried to do the assembly redirect, but it didn't work.

我最终在一个非常简单的方式解决了这一问题。我突然意识到我从来没有使用下面的路线:

I eventually fixed the problem in a very simple way. I suddenly realized I never used the route below:

routes.MapHttpRoute( 
    name: "DefaultApi",
    routeTemplate: "api/{controller}/{id}",
    defaults: new { id = RouteParameter.Optional }
);

所以我删除了这些线和preSTO,又都成功了!

So I deleted these lines and presto, all worked again!

一些研究表明我MapHttpRoute是旧版本的System.Web.Mvc.dll程序的一部分,但不是新版本。因此新DLL与旧版本不兼容。

Some research showed me the MapHttpRoute is part of the older version of the System.Web.Mvc.dll, but not of the newer version. So the new dll is incompatible with the older version.

它仍然困扰着我,一个跑,而我通过Windows更新睡觉生产Web应用程序中断。关闭Windows更新可能是一个解决方案,但使服务器更加脆弱......是什么智慧在这里。

It still bothers me that a running, production web application breaks while I am sleeping by a Windows update. Turning off Windows updates could be a solution, but makes the server more vulnerable... what is wisdom here.

再次感谢大家。

这篇关于MVC应用程序10月15日的Windows升级后突破的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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