Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Problem in applying different rates to different functions #131

Open
tlwang32 opened this issue Jul 2, 2019 · 0 comments
Open

Problem in applying different rates to different functions #131

tlwang32 opened this issue Jul 2, 2019 · 0 comments

Comments

@tlwang32
Copy link

tlwang32 commented Jul 2, 2019

I'd like to set the rate to 2/min for function #1 and to 10/min for the 2nd function following the example as the code below. The code is running fine, but the throttling is not working at all. I can get an unlimited number of "value" and "value1 and value2". Do I also need to change settings in webApiConfig.cs? Please help.

using System.Web.Http;
using WebApiThrottle;
namespace wepApiThrottle.Controllers
{
    [EnableThrottling(PerMinute = 2)]
    public class ValuesController : ApiController
    {
    // GET api/values
    [EnableThrottling(PerMinute = 2)]
    public IEnumerable<string> Get()
    {
        return new string[] { "value1", "value2" };
    }

    // GET api/values/5
    [EnableThrottling(PerMinute = 10)]
    public string Get(int id)
    {
        return "value";
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant