wcfサービスの構成に問題があります。サービスを呼び出すたびに、サービスの新しいインスタンスを作成したいと思います。並行性については、ある呼び出しが別の開始の前に終了したいと思います。
したがって、私がこのようなサービスを持っている場合:
[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;
}
}
ループ内の複数の呼び出しでそれを呼び出すと、トレースは次のようになります。
thread 1
thread 2
start operation
start operation
end operation
end operation
私はこれが欲しいのですが:
thread 1 start operation end operation
thread 2 start operation end operation
これは可能ですか?ありがとうございました