Hy,
I have a Wcf service tat receives files from clients.
The contract:
"UploadFile " and "FileTransfered " are messages.
and the service
The service class implements the asynchronous pattern (the BeginSendFile, EndSendFile and the synchronous method, SendFileToServe r, which is called in the Callback method).
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.Que ueUserWorkItem( ...)), 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
I have a Wcf service tat receives files from clients.
The contract:
Code:
#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
Code:
[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.Que ueUserWorkItem( ...)), 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
Comment