链接:http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2
Update-Package Microsoft.AspNet.WebApi.WebHost -Pre
本地一切正常,但是在服务器上无法构建。错误信息如下:
c:\BuildAgent\work\f8d76a59973cd8a9\Packages\Microsoft.AspNet.WebApi.Core.5.0.0-beta2\lib\net45\System.Web.Http.dll : error CS1705: 程序集 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 使用了高版本的 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a',而引用程序集 'System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 版本过低 [C:\BuildAgent\work\f8d76a59973cd8a9\Aggregator\Spin.TradingServices.Aggregator.Web\Spin.TradingServices.Aggregator.Web.csproj]
我大致理解了发生了什么,并在其他帖子中找到了一些相关信息,但似乎都没有起作用。我希望找到一种只需要更改项目而不是服务器的解决方案。
目前为止我已经:
Set copy local to true, for System.Net.Http
Set up binding redirect.
<assemblyIdentity name="System.Net.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
谢谢,希望有人能帮忙。
System.Net.Http
放在项目文件夹中,这样它会在尝试在其他地方加载之前使用该版本。 - aevitas