C# 服务器错误/应用程序出现以下错误消息:无法加载文件或程序集';更改为MVC5后的Microsoft.Web.Infrastructure

C# 服务器错误/应用程序出现以下错误消息:无法加载文件或程序集';更改为MVC5后的Microsoft.Web.Infrastructure,c#,asp.net,asp.net-mvc,dll,asp.net-mvc-5,C#,Asp.net,Asp.net Mvc,Dll,Asp.net Mvc 5,最近,我们将MVC4更新为MVC5。我有一个用于报告目的的Web服务,当我启动Web服务时,我发现以下错误 [FileNotFoundException: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system can

最近,我们将MVC4更新为MVC5。我有一个用于报告目的的Web服务,当我启动Web服务时,我发现以下错误

[FileNotFoundException: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   System.Web.WebPages.PreApplicationStartCode.Start() +0
   System.Web.Mvc.PreApplicationStartCode.Start() +37

[InvalidOperationException: The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +850
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +162
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +128
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +170
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +820

[HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688

我没有在我的服务中引用此Microsoft.Web.Infrastructure.dll,但升级到MVC5后出现此dll问题。有任何帮助吗?

Microsoft.Web.Infrastructure.dll是关键库。您应该添加这个,可能是内部需要/引用的。
您可以在packages.config文件和web.config中检查所有dll引用

或者它可能存在于本地,但您没有使其在其属性中将本地复制为True