c# - 无法加载文件或程序集 'System.Web.Http,版本 = 5.2.2.0

标签 c# odata

我将 Odata v4 包 添加到我的 API 中,我注意到它将我的 Microsoft.AspNet.WebApi 包更新到 5.2.3版本。但是当我尝试使用

odata builder configuation in my WebApiConfig it showing error like 'Could not load file or assembly 'System.Web.Http, Version=5.2.2.0'.

config.MapODataServiceRoute("odata", null, GetEdmModel(), new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));

我在我的项目中搜索了这个版本 (5.2.2),但所有东西都是 5.2.3,我也更新了所有包以解决这个问题但失败了。 复制到本地属性对于 System.Web.Http dll 也适用。
有什么想法吗?

最佳答案

Visual Studio 帮我解决了这个问题。版本冲突显示为警告,当我单击它时,它会自动将绑定(bind)重定向添加到我的 Web 配置中。

https://msdn.microsoft.com/en-us/library/2fc472t2.aspx

解决我的问题的绑定(bind)重定向是,

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31BF3856AD364E35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31BF3856AD364E35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
</assemblyBinding>

关于c# - 无法加载文件或程序集 'System.Web.Http,版本 = 5.2.2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31207110/

相关文章:

asp.net - OData 和区分大小写

python - 精确在线 API : deleting and updating items like BankEntryLines

c# - 如何从 .net 中的网络服务器连接数据库?

c# - C#Api Last.FM这是错误吗?

c# - 我如何在客户端(DataServiceContext)加密 OData 请求负载并在服务器端解密请求?

c# - 如何使用 AutoMapper 和 OData 扩展子级别?

javascript - Microsoft Dynamics CRM - 用于检索实体的两个选项集属性的标签的 OData URL 格式是什么?

C#:没有重复的骰子排列

javascript - MVC AJAX 查询回调不起作用

c# - Java 中 C# 用户定义转换的替代方案