nerdexam
Microsoft

70-513 · Question #310

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 <ServiceContract0> 02 PuElic…

The correct answer is A. Add the following attribute to the TeamMessageService class, before line 10. See the full explanation below for the reasoning.

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 <ServiceContract0> 02 PuElic Interface ITeamMessageService 04 <OperationContractO> 05 Function GetMessage() As String 07 <OperationContract0> 08 Sub PutMessage(Byval message As String) O9 End Interface The code for the serAce class is as follows. 10 Public Class TeamMessageService0 11 Implements lTearmt4essageService 13 Dim key As Guid = Guid.NewGuid() 14 Dim message As String = "Today's Message' 16 PuUic Function GetMessage0As String - 17 lmpements lTearm*AessageServiceGetMessage 19 Retun String. Fommat("Message:{0) Key:{ 1}", message, key) 20 End Function 22 PubIic Sub PutMessage(ByV message As Stnng) - 23 lmpements lTearrlessageService PutMessage 25 Me message = message 26 End Sub 28 End Class The service is self-hosted The hosting code rs as follows 29 Dim host As ServiceHost = New ServiceHost(GetType(TearrwiessageSeMce))? 30 Dim binding As Basic HttpBindngt New BasicHttpBindiig(BasicHttpSecurityMode. None) 31 host.AddServiceEndpoint( "MyAppication lTearrtAessageService", binding Thttp /Ilac aihost. 1 2345) 32 host Open() You need to ensure that all clients calling GetMessage will retrieve the same string, even if the message is upd(ed 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 10002E
  • CPass a service instance to the instancing code in line 29, as follows.
  • DRedefine the message string in line 14, as follows.

How the community answered

(42 responses)
  • A
    83% (35)
  • B
    5% (2)
  • C
    2% (1)
  • D
    10% (4)

Community Discussion

No community discussion yet for this question.

Full 70-513 Practice