I would like to understand the property ServiceBehavior.ConcurrencyMode.
Consider the following code from the service side:
[ServiceContract]
public interface IMySercice {
[OperationContract]
int mycall(int a);
}
[ServiceBehaviour(InstanceContext = InstanceContextMode.Single)]
public class MyService : IMyService {
public int mycall(int a) { ... }
}
class Program {
static void Main(string[] args) {
MyServiceMyS = new MyService(...);
Uri MyUri = new Uri("http://services.mycompany.com/services/");
using (ServiceHost host = new ServiceHost(MyS)) {
host.Start();
host.Stop();
}
}
}
Now consider what I would call this service, please consider 10 machines on the Internet that can call me. At some point it happens that these 10 machines ALL MAKE 10 simultaneous requests for int mycall(int a). I would like to study these scenarios:
SCENARIO 1
...
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContext = InstanceContextMode.Single)]
public class MyService : IMyService {
...
}
...
SCENARIO 2
...
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContext = InstanceContextMode.Single)]
public class MyService : IMyService {
...
}
...
So, there are 10 simultaneous calls ... what happens in both cases? Please tell me whether I am right or wrong:
1, , 10 . ( ) . 2 WCF 10 .
, ?