相关疑难解决方法(0)

如何在Web Api中限制请求?

我正在尝试通过以下方式实现请求限制:

在ASP.NET MVC中实现请求限制的最佳方法?

我已将该代码提取到我的解决方案中,并使用以下属性修饰了API控制器端点:

[Route("api/dothis/{id}")]
[AcceptVerbs("POST")]
[Throttle(Name = "TestThrottle", Message = "You must wait {n} seconds before accessing this url again.", Seconds = 5)]
[Authorize]
public HttpResponseMessage DoThis(int id) {...}
Run Code Online (Sandbox Code Playgroud)

这会编译,但属性的代码不会被命中,并且限制不起作用.我没有收到任何错误.我错过了什么?

.net c# throttling asp.net-web-api

41
推荐指数
4
解决办法
4万
查看次数

标签 统计

.net ×1

asp.net-web-api ×1

c# ×1

throttling ×1