我正在尝试在安装了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文件夹中上传文件。我做到了,我尝试了三次
但我得到的只是错误。我正在使用来自本地主机提供商的共享主机,因此无法运行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
答案 0 :(得分:-1)
文件在那里,环境听起来准备就绪。
如果应用程序池已配置为Net4.5集成,则应该全部使用。
您的配置似乎可能存在问题。
我建议您在本地IIS服务器上安装该应用程序,并查明是否发生了同样的错误。
我遇到过类似的问题,因为之前的应用程序已经从一个版本的MVC升级到另一个版本,这留下了项目文件和配置中多个版本的引用的痕迹。
应用程序在开发中工作正常,但在生产服务器上却没有。
在本地IIS服务器上安装(最好与托管服务提供商相同)通常可以更轻松地解决问题。如果您在本地IIS上运行它,您就可以了解如何在远程服务器上执行相同操作。我希望您具有远程IIS访问权限,这样可以更轻松地验证差异。