OData API的节流处理程序。

问题描述 投票:0回答:1

我有一个OData API,它工作正常,并返回预期的结果。当我添加 ThrottlingHandler() 源于 DeletgatingHandlerOData Route 它抛出

错误。

500 内部服务器错误

响应不包含任何数据。

OData Route.TrottlingHandler() : DelegateHandler

    var builder = new ODataConventionModelBuilder();
    builder.EntitySet<Session>(ControllerResources.Session);
    var model = builder.GetEdmModel();

    var pathHandler = new DefaultODataPathHandler();
    var routingConventions = ODataRoutingConventions.CreateDefault();
    var routeConstraint = new ODataPathRouteConstraint(pathHandler, model, Area,   routingConventions);

    var route = new ODataRoute(ControllerResources.ODataRoutePrefix,  routeConstraint, new HttpRouteValueDictionary(), new HttpRouteValueDictionary(),    new HttpRouteValueDictionary(),  **new ThrottlingHandler()**);

    routes.Add(Area, route);

ThrottlingHandler() : DelegateHandler.

    returnValue = base.SendAsync(request, cancellationToken);

    return returnValue;
odata
1个回答
0
投票

@Sukhvinder Uppal

我想同步之后就可以解决了。对吧?

© www.soinside.com 2019 - 2024. All rights reserved.