You are developing a Calculator service which performs mathematical operation. How you can enable session in your WCF Calculator Service?

  1. [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples", SessionMode=SessionMode.Required)] public interface ICalculator{ [OperationContract] double AddTo(double n); }

  2. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] public class CalculatorService : ICalculator { double result = 0.0D; public double AddTo(double n) { return result+=n; } }

  3. a and b both

  4. None of the above


Correct Option: C

Find more quizzes: