我正在尝试在安装了 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文件夹下的文件。我做到了,我尝试了三次
- 任何 CPU 版本
- 64 位构建
- 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/