Silverlight + WCF Communication
-
I have a silverlight application which uses wcf service hosted in a wpf application, but when I try to connect more then one client the second client always waits until the first client completes the call.How can I make WCF to accept calls from multiple clients at the same time?
-
I have a silverlight application which uses wcf service hosted in a wpf application, but when I try to connect more then one client the second client always waits until the first client completes the call.How can I make WCF to accept calls from multiple clients at the same time?
I would start by setting the service ConcurrencyMode to Multiple
\[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple\] public class MyService : IMyService { ...
If you have operations that take time and/or block (like pretty much any device I/O operation does), which apparently you do, you should implement the service operation(s) asynchronously: Synchronous and Asynchronous Operations[^] Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I would start by setting the service ConcurrencyMode to Multiple
\[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple\] public class MyService : IMyService { ...
If you have operations that take time and/or block (like pretty much any device I/O operation does), which apparently you do, you should implement the service operation(s) asynchronously: Synchronous and Asynchronous Operations[^] Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Thanks for the answer,But I already used [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple],but the problem still exists,Also implemented the service as asynchronously,Could you suggest any other solutions?
I have no idea what's wrong. It could be in host configuration, service configuration, or the service implementation. I can't reproduce this, even without the [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]. Even a synchronously implemented operation like
public string EchoStringSynchronous(string msg) { Thread.Sleep(10000); return msg; }
can be executed by multiple clients without a client having to wait for another client's operation to complete.
Mark Salsbery Microsoft MVP - Visual C++ :java: