News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

Advertisement

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;
01 [ServiceContract(CallbackContract=typeof(INameService))]
02 public interface IGreetingService
03 {
04 [OperationContract]
05 string GetMessage();
06 }
07 [ServiceContract]
08 public interface INameService
09 {
10 [OperationContract]
11 string GetName();
12 }

The code that implements the IGreetingService interface is as follows

20 public class GreetingService : IGreetingService
21{
22 public string GetMessage()
23 {
24 INameService clientChannel = OperationContext.Current.GetCallbackChannel <INameService>();
25 string clientName = clientChannel.GetName();
26 return String.Format("Hello {0}", clientName);
27 }
28 }

The service is self-hosted. The hosting code is as follows.

30 ServiceHost host = new ServiceHost(typeof(GreetingService));
31 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
32 host Add ServiceEndpoint(MyApplic ation lGreetingService", binding,`nettcpillocalhost 12345");
33 host OpenO:

The code that implements the lNameService interface is as follows.

40 class NameService : INameService
41 {
42 string name;
43 public NameService(string name)
44 {
45 this.name = name;
46 }
47 public string GetName()
48 {
49 return name;
50 }
51 }

Currently, this code fails at runtime, and an Invalid Operation Exception is thrown at line 25. You need to correct the code so that the call from the service back to the client completes successfully. What are two possible ways to achieve this goal (Each correct answer presents a complete solution. Choose two.)

  1. Change the service contract definition in line 01 as follows.

    [ServiceContract(CallbackContract = typeof(INameService), SessionMode = SessionMode.Required)]
  2. Add the following attribute to the NameService class, before line 40.

    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]
  3. Add the following attribute to the GreetingService class, before line 20.

    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]
  4. Add the following attribute to the GreetingService class, before line 20.

    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
Answer: Answer is c, d
comments powered by Disqus
Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;