Is there a way to use this with a standard MVC project?

Jul 13, 2014 at 11:37 PM
Is there a way to use this with a standard MVC project? I have an api although I opted not use web api for various reasons. I just use MVC controllers and return JavaScriptResult for a JsonP implementation. Is there a way to still use this library? I see in the docs you make use of the WebApiConfig and the project overall seems to be webapi specific.

Also I am assuming this library does not work correctly with web farms? I am using windows azure and have 2-6 servers that handle requests depending on load.

Can I first process the requests before they get throttled? My requests are base 64 encoded, and I would need to pull an id off the query string after decoding to use an the identifier to see if the limit has been reached. I would use this ID instead of an IP address since the requests coming from multiple clients. Thanks!
Jul 14, 2014 at 12:23 AM
Edited Jul 14, 2014 at 12:24 AM
UPDATE: I created a test MVC project and added the nuget package with no problems. I then registered the WebApiConfig in my Global.asax file and that works fine too. I tried the code from the documentation but no luck:
      IEnumerable<IThrottlingControllerInstance> instances =
            new List<IThrottlingControllerInstance>(new[]
        {
            ThrottlingControllerInstance
                .Create<ShortAverageThrottlingController>("bulk", 10000, 1)
                    .IncludeInScope("test/")

I created a test controller here and tried to limit the requests to 1 request per 10 seconds, but it doesn't seem to work. I tried using test/, test, test*, and test/*.

I couldn't get the statistics wired up because the sample code is assuming I am using the web api routing.

I also don't see anywhere in the documentation to define how the requests are limited (using an account id for instance instead of ip). I need to use my own identifier as I mentioned in my first post.