Reputation: 81
I have a WCF service hosted on a server and another console application on multiple clients. Each console application send a request to download a specific file on server and I want to check how many downloads are currently active if more than 4 I want the WCF to deny the request if less then send the file. I don't know what is the best solution to detect the number of active downloads.
Upvotes: 0
Views: 73
Reputation: 3757
You can use Service Throttling of WCF. It can limit the number of concurrent calls:
You can also program your own control, marking the service as Single, like this:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
And control the number of files with a static variable. It's not so clear but works.
Upvotes: 2