I have an issue with my wcf service config.
I would like every call to my service create a new instance of the service.
For the concurrency I would like to one call is finished before another start.
Thus if I have a service like this one:
[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Single,
InstanceContextMode=InstanceContextMode.PerCall)]
public class MyService: IMyService
{
public bool MyServiceOp()
{
Debug.WriteLine("thread "+
Thread.CurrentThread.ManagedThreadId.ToString());
Debug.WriteLine("start operation ");
Do_work()
Debug.WriteLine("end operation");
return true;
}
}
When I call it with multiple call in a loop, the trace give:
thread 1
thread 2
start operation
start operation
end operation
end operation
While I would like to have this:
thread 1 start operation end operation
thread 2 start operation end operation
Is this possible? Thank you
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…