You are creating a Windows Communication Foundation service by using Microsoft .NET Framework 3.5.
You create the following service contract.
[ServiceContract]
public interface IMyService
{
[OperationContract]
void DoSomething();
}
The service will not use any external resources.
You need to ensure that the calls to the DoSomething operation are thread-safe.
What are the two possible service implementations that you can use to achieve this goal?
(Each correct answer presents a complete solution. Choose two.)
A.
[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, InstanceContextMode=InstanceContextMode.Single)]
public class serviceImpl : MyService
{
public void DoSomething(){ }
}
B.
[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Single, InstanceContextMode=InstanceContextMode.Single)]
public class serviceImpl : MyService
{
public void DoSomething(){ }
}
C.
[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, InstanceContextMode=InstanceContextMode.PerSession)]
public class serviceImpl : MyService
{
public void DoSomething(){ }
}
D.
[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple,InstanceContextMode=InstanceContextMode.PerCall)]
public class serviceImpl : MyService
{
public void DoSomething(){ }
}