无法加载文件或程序集“System.Web.Http.WebHost,版本=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35" [英] Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35'
问题描述
在 Visual Studio 2012 中,我创建了一个 ASP.NET MVC 4 项目,其中目标框架是 .NET Framework 4.5.当我将项目部署到 Web 服务器时,出现以下错误:
In Visual Studio 2012 I created an ASP.NET MVC 4 project where the target framework is the .NET Framework 4.5. When I deployed my project to a web server it gave the following error:
Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file
specified.
Description: An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where
it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or
assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
The system cannot find the file specified.
Source Error:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237
推荐答案
检查已部署项目的 bin 文件夹.它应该包含 System.Web.Http.WebHost.dll.如果此 dll 在此文件夹中,请检查它的版本.如果它不是 4.0.0.0,那么您应该部署 4.0.0.0 版本或更改您的网络配置以使用其他版本(由于依赖关系,这不是一个好主意)
Check the bin folder of your deployed project. It should contain System.Web.Http.WebHost.dll. If this dll is in this folder, check it version. If it isn't 4.0.0.0, then you should deploy version 4.0.0.0 or change your web config to use other version (not really good idea because of dependencies)
这篇关于无法加载文件或程序集“System.Web.Http.WebHost,版本=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!