So, I host the WCF service in a WinForms application. I have the following
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.PerCall)] public class Test : ITest { public string TestIt(string input) { Thread.Sleep(5000); return "test"; } }
I use Named Pipes and have two instances of another application that act as clients in the above WCF service (works in WinForms application). I thought that based on the ConcurrencyMode Multiple parameter, when Client1 calls the test service, Client2 should not wait for the first call to complete. However, when Client1 calls TestIt, Client2 blocks until the call from Client1 is completed!?!?! Shouldn't he create a new instance each time based on the above settings?
Also, is the best way to save a WinForms application that runs the WCF service is to start the WCF service in a separate thread?
NOTE. Setting [CallbackBehavior (UseSynchronizationContext = false)] in the Test class does not alleviate the problem. The service still only responds to one request at a time.
source share