Limit the number of asyn web service calls

P

Paul Welter

I have a web service the makes calls asynchronously to a server to download
files. The user has the ability to select many files to download. When
making the web service call using the proxy class, the async call goes on
the thread pool. The problem is that the thread pool can have 25 threads.
So, the user could potentially be downloading 25 files at a time. This will
overwhelm the clients internet connection. I'd like to find an easy way to
limit the number of async calls while queuing the rest without blocking the
UI thread. How do I change the number of threads the thread pool can have?
Do I have to implement my own thread pool? If so, how would I do that and
how would I tell the proxy class to use my thread pool?

thanks
Paul
 
M

MSFT

Hi Paul,

The ThreadPool class in .NET only support to set minthread number, not with
maxthreads number. I think you may consider create a queue object in your
application, when user want to download files, you may add the file list to
the queue component and let this component to control the number of files
which will be download at same time. Will this help on the situation?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top