I am attempting to run multiple instances of the same WCF service in Visual Studio 2012. The service needs to be stateful so I am using [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]. The services needs to mimic server behaviour in that they must maintain state no matter which client connects to them.
How can I do this?
— EDIT —
An example:
There’s three instances of the service called Shop1, Shop2 and Shop3. Each have their own balance as a “state”. Client1 and Client2 now buys something from Shop1, which involves increasing the balance of Shop1. Client 3 purchases something from Shop2 which increases it’s balance.
The intention is that Shop1, Shop2 and Shop3 are hosted on different machines, but for testing purposes I would like to run them on the same machine.
use callback model against two-way, you will can process more clients
or
set
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]and save state in static properties