Search code examples
wcfwcf-securitywcf-web-api

Preventing flooding in WCF


I'm using WCF Web API. I want to prevent flooding on method calls. I've limited maxConcurrentCalls to 10. But I need more constraints. For example, if some client calls same method in 3 sec., it must throw an exception about flood call. Also if some client calls same method with same paramters for ten times per a minute, it must be prevented. How can I do that in a simple way?


Solution

  • There is nothing you can do on your service side to prevent clients from making requests. If you are anticipating high volume then you need to ensure your service endpoint is scaled out by putting a load balancer in front.

    The best you could do is implement a per-session instance mode then return an exception if there are too many calls on the same session. This would still mean you would need to process the individual calls.

    There may a way you can use a network load balancer to block surplus requests but I think this is unlikely.