c# - Microsoft.Web.Infrastructure,Version=1.0.0.0 无法在 Windows 2012 64 位、MVC5 上加载

标签 c# asp.net-mvc visual-studio-2012

我正在尝试在安装了 Plesk 的 Windows 2012 64 位操作系统上上传一个简单的网站。我使用带有 Visual Studio 2013 的 FTP 发布来使用 .NET 4.5 在虚拟目录中上传站点。但是我得到了

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.

根据StackOverflow或Search的帖子比较多,建议大家上传bin文件夹下的文件。我做到了,我尝试了三次

  1. 任何 CPU 版本
  2. 64 位构建
  3. x86Build

但我得到的只是上述错误。我正在使用来自本地托管服务提供商的共享托管,因此无法运行 aspnet_regiis -i 来确保 .net 4.5 配置是否正确,技术人员正在争论证明/显示 .net4.5 是否正确未安装或工作不正常。

知道我应该如何让它运行吗?

编辑:我的 bin 文件夹有这些文件:

System.Web.Webpages.Razor.dll
System.Web.Webpages.dll
System.Web.Webpages.Deployment.dll
System.Web.Razor.dll
System.Web.Mvc.dll
System.Web.Helpers.dll
System.Web.Extensions.dll
System.Web.Entity.dll
System.Web.DynamicData.dll
System.Web.dll
System.Web.ApplicationServices.dll
System.EnterpriseServices.dll
Microsoft.Web.Infrastructure.dll

除了项目的dll

编辑 2:

错误的堆栈跟踪:

[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() +32

[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) +556
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[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) +9885060
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

最佳答案

文件在那里,环境声音准备就绪。

如果应用程序池已配置为 Net4.5 Integrated,您应该一切顺利。

看来你的配置可能有问题。

我建议您将应用程序安装在本地 IIS 服务器上,看看是否会出现同样的错误。

我遇到过类似的问题,因为应用程序之前已从一个版本的 MVC 升级到另一个版本,这在项目文件和配置中留下了多个引用版本的痕迹。

应用程序在开发服务器上运行良好,但在生产服务器上运行不佳。

在本地 IIS 服务器上安装(最好是与您的托管服务提供商相同的版本)通常可以更容易地解决问题。如果您让它在本地 IIS 上运行,您就可以了解如何在远程服务器上执行相同的操作了。我希望您可以远程访问 IIS,这样可以更轻松地验证差异。

关于c# - Microsoft.Web.Infrastructure,Version=1.0.0.0 无法在 Windows 2012 64 位、MVC5 上加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24799053/

相关文章:

c# - 在数据绑定(bind)表达式中调用具有 void 返回类型的方法

c# - 当 DoubleBuffered 设置为 true 时覆盖 OnPaint 的问题

c# - 如何在MVC中查看PDF文档而不是直接下载?

c# - 如何在c#中的for循环中修剪和追加一个字符串

c# - C# 中这两个 List<char> 初始化的区别

angular - 升级到.Net Core 3.1后,“事件/就绪”探针失败

c# - 将 URL 字符串转换为 area + action + controller

c# - 给定点的样条法线

c++ - Project Only -> Clean Only 项目正在清理 Visual Studio 2012 中的其他项目

visual-studio-2012 - 通过Visual Studio取消待处理的更改会挂起大量更改