Web Api 2 RESTful API(版本化) - 需要使用过滤器的操作

时间:2018-06-05 07:41:36

标签: c# asp.net-web-api2

我们有基于Web Api 2构建的RESTful API,它运行在多个版本上。目前它并不支持Get(所有实体),因为我们拥有大量实体。现在我们正尝试使用OData支持使用过滤器的v2 /付款。但它的应用程序崩溃在Startup.cs如下

[ArgumentException: An item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +10695474
System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +10
System.Web.Http.Description.ApiExplorer.TryExpandUriParameters(IHttpRoute route, HttpParsedRoute parsedRoute, ICollection`1 parameterDescriptions, String& expandedRouteTemplate) +407
System.Web.Http.Description.ApiExplorer.PopulateActionDescriptions(HttpActionDescriptor actionDescriptor, IHttpRoute route, String localPath, Collection`1 apiDescriptions) +258
System.Web.Http.Description.ApiExplorer.ExploreDirectRoute(HttpControllerDescriptor controllerDescriptor, CandidateAction[] candidates, IHttpRoute route) +358
System.Web.Http.Description.ApiExplorer.InitializeApiDescriptions() +410
System.Lazy`1.CreateValue() +416
System.Lazy`1.LazyInitValue() +152
System.Lazy`1.get_Value() +75
System.Web.Http.Description.ApiExplorer.get_ApiDescriptions() +40

有没有办法支持ApiController和OData查询?

由于

0 个答案:

没有答案
相关问题