【问题标题】:Could not load file or assembly System.Net.Http, Version=4.0.0.0 with ASP.NET (MVC 4)无法使用 ASP.NET (MVC 4) 加载文件或程序集 System.Net.Http,版本 = 4.0.0.0
【发布时间】:2014-02-09 21:52:37
【问题描述】:

我关注Could not load file or assembly System.Net.Http, Version=4.0.0.0 with ASP.NET (MVC 4) Web API OData Prerelease

我遵循您的建议步骤。我使用统一。我在Boostrapper.Initialize 上收到了一个问题。这个问题说"An exception of type 'System.IO.FileLoadException' occurred in SupportCours2.dll,但没有在用户代码中处理

补充资料:

Could not load file or assembly 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)" and in the inner I have {"Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 
The located assembly's manifest definition does not match the assembly reference. 
(Exception from HRESULT: 0x80131040)":"System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"} 

内部是奇怪的 4.0 版本,顶部是 5.0

我尝试了很多事情:我关注升级http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2,我在哪里可以找到用于升级到 System.Web.Http v5.0.0.0 的 NuGet 包?并且无法使用 ASP.NET (MVC 4) Web API OData Prerelease 加载文件或程序集 System.Net.Http, Version=4.0.0.0

我也遵循您的建议,使用“pre”版本并修改 web.config。我没有工作。

你能帮忙吗?

最好的问候,亚历山大

【问题讨论】:

    标签: asp.net-mvc


    【解决方案1】:

    这个对我有用: 写在“包管理器控制台”

    Update-Package Microsoft.AspNet.WebApi -reinstall
    

    【讨论】:

      【解决方案2】:

      以下 NuGet 包对我有用,

      `Install-Package Microsoft.AspNet.WebApi -Version 5.0.0`
      

      【讨论】:

        【解决方案3】:

        这可能是一个简单的问题,只是 dll 文件没有复制到您构建的“bin”文件夹中。

        参考:https://msdn.microsoft.com/zh-tw/library/t1zz5y8c(v=vs.100).aspx

        【讨论】:

          【解决方案4】:

          更新配置文件时需要另存为配置 文件类型

          【讨论】:

            猜你喜欢
            • 2013-09-29
            • 1970-01-01
            • 1970-01-01
            • 2016-11-19
            • 2017-07-21
            • 1970-01-01
            • 2018-03-15
            • 1970-01-01
            相关资源
            最近更新 更多