I have a Wcf service tat receives files from clients.
The contract:
Expand|Select|Wrap|Line Numbers
- #region ServiceContract
- [ServiceContract]
- public interface IWcfService
- {
- [OperationContract(AsyncPattern = true)]
- IAsyncResult BeginSendFile(UploadFile file, AsyncCallback callback, object state);
- FileTransfered EndSendFile(IAsyncResult ar);
- }
- #endregion ServiceContract
and the service
Expand|Select|Wrap|Line Numbers
- [ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, InstanceContextMode=InstanceContextMode.PerCall)]
- public class WcfService : IWcfService
Ex1: If on the client I generate the proxy class with asynchronous operations and call BeginSendFile for each file, the server acts asynchronously (it processes multiple files at a time).
Ex2: But if I generate the proxy without asynchronous operations, and call SendFile in a thread from ThreadPool (ThreadPool.QueueUserWorkItem(...)), one for each file, the server acts synchronously (it processes the files one at a time).
Why doesn't the server act async on the Ex2 scenario?
P.S. I followed this tutorial this tutorial. On "Client" section, it is the Ex2 scenario