nerdexam
Microsoft

70-513 · Question #297

70-513 Question #297: Real Exam Question with Answer & Explanation

Sign in or unlock 70-513 to reveal the answer and full explanation for question #297. The question stem and answer options stay visible for context.

Question

A Windows Communication Foundation (WCF) solution uses the following contract to share a message across its clients. (Line numbers are included for reference only.) 01 [ServiceContract] 02 public interface ITeamMessageService 03 { 04 [OperationContract] 05 string GetMessage0; 07 [OperationContract] 08 void PutMessage(string message); 09) The code for the service class is as follows 10 public class TeamMessageService: ITeamMessageService 11 { 12 Guid key = GuicLNewGuidO; 13 string message = "Today's Message": 14 public string GetMessage() 15 { 16 return stringFormat("Message:{0} Key:{1}", message, Key); 17 19 public void PutMessage(string message) 20 { 21 thismessage = message; 22 } 23 ) The senvice is self-hosted. The hosting code is as follows. 24 ServiceHost host = 25 BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecuntyMode.None): 26 host AddServiceEndpoint( HMyApplication lTeamMessageService, binding, "http:/Ilocalhost: 12345w); 27 host Open0;) You need to ensure that all clients calling GetMessage will retrieve the same string, even if the message is updated by clients calling PutMessage What should you do?

Options

  • AAdd the following attribute to the TeamMessageService class, before line 10.
  • BAdd the following attribute to the TeamMessageService class, before line 10.
  • CPass a service instance to the instancing code in line 24, as follows.
  • DRedefine the message string in line 13, as follows

Unlock 70-513 to see the answer

You've previewed enough free 70-513 questions. Unlock 70-513 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 70-513 Practice