Divide Work among Multiple Threads in a .NET Web Service Client


Determine appropriate roles for individual threads when multi-threading a .NET Web service client. Multi-threading .NET Windows Forms* applications is a powerful means of improving their performance and maintaining responsiveness, even when invoking potentially long-running Web services. Those gains can be lost, however, if appropriate division of labor among individual threads is not observed.


Place potentially time-intensive operations on a thread other than the user-interface thread. For a .NET Windows Forms client application, the principal benefit of multi-threaded programming is that it can improve responsiveness considerably. Windows Forms has strict thread-affinity requirements: all user interface activity associated with a particular window must happen on a single thread.

This means that any code that updates the appearance of a window, or that handles any user input to that window, must be run on that window's thread. The consequences of this requirement for the application's responsiveness are obvious: if your program performs an operation that takes a long time on the user-interface thread, the program will not be able to respond to user input until that operation is complete.

Further investigation of threading a .NET Web service client is addressed in these separate items:

Multithreaded .NET Web Service Clients