Last post Apr 11, 2014 04:17 AM by Fuxiang Zhang - MSFT
Apr 10, 2014 11:13 AM|zubol|LINK
I would like to have many instances of the same service at the server.
Unfortunately, I cannot use multi-threads (3rd party dll's does not support multi-thread)
I thought to have some kind of router/switch which will get request from the client and depend on the occupancy of instances send this request to the free one.
For example: Let says service method takes 2 minutes to proceed. By standard implementation 5 request will take 10 mins. I would like to have a solution in which 5 instances of service are created on the server and proceed them parallel, so the total
time will be around 2 mins.
I tried to play with Instances (
ConcurrencyMode = ConcurrencyMode.Single,
InstanceContextMode = InstanceContextMode.PerCall
and with Routing, but unfortunately without success.
Is any out of the box solution for that? or would you be able to point me how to start?
Thanks a lot,
Apr 11, 2014 04:17 AM|Fuxiang Zhang - MSFT|LINK
ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.PerCall
Welcome to asp.net forum.
From above code, I see you set the the InstanceContextMode as percall, that make sure every request will own a instance context.
no matter ConcurrencyMode is single or multiple, all the process for requests are parallel. So you would not using any router.
Please note that as for same client proxy, we should open the service proxy explicitly before call wcf service.
//open the proxy before call service
(proxy as I communicationObject).Open();
//.....your code call service method
For WCF Concurrency (Single, Multiple, and Reentrant) and Throttling, please check below.
Beside, I suggest you take a look at the article about WCF Load Balancing.
Hope that helps, thanks.