Hi all,
I developed a proof of concept application that query if WCF support multi-threading.
Now, all what i did is creating a service contract marked with [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = true)] with two operations to get fixed texts. The first method do a Thread.Sleep for 8 seconds to make the response delayed and the other one return data directly.
The issue i faced was when i run two instances of client application and request from the first client the method with delay and request the other method from the second client, i got a sequential response.
The question is, How to get the response from the service while the service is busy with another request?
namespace WCFSyncService
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)],
ConcurrencyMode = ConcurrencyMode.Multiple,
UseSynchronizationContext = true)]
public class ServiceImplementation : IService
{
public ServiceImplementation()
{
}
#region IService Members
public string GetDelayedResponse()
{
System.Threading.Thread.Sleep(8000);
return "Slow";
}
public string GetDirectResponse()
{
return "Fast";
}
#endregion
}
}
I NEED TO CALL THE METHODS GetDelayedResponse & GetDirectResponse AT THE SAME TIME AND GET THE "FAST" TEXT BEFORE THE 8 SECONDS ENDS.
Thanks in advance,