Microsoft
70-513 · Question #147
70-513 Question #147: Real Exam Question with Answer & Explanation
Sign in or unlock 70-513 to reveal the answer and full explanation for question #147. 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 04 <OperationContract()> 05 Function GetMessage() As String 07 <OperationContract()> 08 Sub PutMessage(ByVal message As String) 09 End Interface The code for the service class is as follows. 10 Public Class TeamMessageService 11 Implements ITeamMessageService 13 Dim key As Guid = Guid.NewGuid() 14 Dim message As String = "Today s Message" 16 Public Function GetMessage() As String _ 17 Implements ITeamMessageService.GetMessage 19 Return String.Format("Message:{0}. Key:{1}", message, key) 20 End Function 22 Public Sub PutMessage(ByVal message As String) _ 23 Implements ITeamMessageService.PutMessage 25 Me.message = message 26 End Sub 28 End Class The service is self-hosted. The hosting code is as follows. 29 Dim host As ServiceHost = New ServiceHost(GetType(TeamMessageService)) 30 Dim binding As BasicHttpBinding = New BasicHttpBinding(BasicHttpSecurityMode.None) 31 host.AddServiceEndpoint( "MyApplication.ITeamMessageService", binding, 32 host.Open() You need to ensure that all clients calling GetMessage will retrieve the updated string if the message is updated by any client 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 10002E
- CPass a service instance to the instancing code in line 29, as follows.
- DRedefine the message string in line 14, as follows.
- EThen change the implementation of PutMessage in lines 22-26 to the following.
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.