0

I have a Web service create by WCF, and it could response for the client's request, such as adding or updating data.

Let's call the main part of service Context, because some method(supposed method A) would spend a long time to handle, but I don't want the method hold the server, I set the InstanceContextMode enum to PerCall, and I expect that each time I call A, it will create a new instance to serve the request, then my server could continue to server other one's as usual.

But my problem is, it still use Main thread(UI thread) to serve each time, so when I call A, the server will stop response for a long time, till A done.

Did I miss anything? I'm a novice of WCF, so please let me know if I had any mistake.

Alanight
  • 353
  • 2
  • 8
  • 23
  • 2
    If you have a long running process, then a web service is probably not the right way to do it. The `InstanceContextMode` of the service (or any other setting of the service) has absolutely no connection with the client. If you must use WCF for the long-running process, then a) make the call async so it doesn't freeze your UI, and b) make the service method a one-way call so the client isn't waiting for the long-running process to complete. – Tim Jan 29 '16 at 05:34
  • @Tim I have to apologize that I've might ask toward wrong direction... I should change _ConcurrencyMode_ rather than _InstanceContextMode_ for achieving my goal. Still appreciate for your advice, that gave me useful reference. – Alanight Jan 29 '16 at 06:42

0 Answers0