70-513 · Question #291
A Windows Communication Foixdation (WCF) solution uses the following contracts (Line numbers are included for reference only) 01 eServiceContract(Callback contract: GetType(lNameService))> 02 Putlic…
The correct answer is C. Add the following attribute to the GreetingService class, before line 20. D. Add the following attribute to the GreetingService class, before line 20. See the full explanation below for the reasoning.
Question
A Windows Communication Foixdation (WCF) solution uses the following contracts (Line numbers are included for reference only) 01 eServiceContract(Callback contract: GetType(lNameService))> 02 Putlic Interface I(IeetingService 04 <OperationContractO> 05 Function GetMessage() As Stnng 07 End Interface 09 <ServiceContractO> 10 Public Interface INameService 12 <OperationContractO> 13 Function GetName() As String 15 End Interface The code that implements the KleetingService interface is as follows. 20 Public Class GretingService 21 Impements lGreaingService 23 Public Function GetMessage0As String - 24 lmpements IGredingService. GetMessage 26 Dim clientChann As INameService = 27 OperationContet. Current. 28 GetCallbackChamel(Of INameService)() 29 Dim clientName As String = clientChannelGetName() 30 Retumn String Format("Hello {O)", clientName) 32 End Function 33 hnd Class The service is self-hosted The hosting code is as follows. 35 Dim host As SeniceHost = 36 New ServiceHost(GetType(GrstingService))? 37 Dim binding As NetTcpBinding = 38 New NetTcpBinding(Sec urityMode. None) 39 hostAddServiceEndpoint('Myapplication lGreetingService". 40 bincng, net.tcp:Ilocalhost: 12345W) 41 HotOpen()l The code that implements the INameService interface is as follows. 42 Class NameService 43 lmpements INameService 45 Dim name As String 47 Public Sub NameService(ByV name As String) 48 Me.reme = name 49 End Sub 51 Public Function GetName() As String - 52 lmpements INameService. GeName 54 Reti.rn name 55 End Function 56 End Class Currently, this code fails at runtime, and an Invalid Operation Exception is thrown at mne 25. You need to correct the code so that the call from the service back to the client complets successfully What e two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
Options
- AChange the service contract definition in line 01 as follows.
- BAdd the following attribute to the NameService class, before line 40.
- CAdd the following attribute to the GreetingService class, before line 20.
- DAdd the following attribute to the GreetingService class, before line 20.
How the community answered
(40 responses)- A13% (5)
- B8% (3)
- C80% (32)
Community Discussion
No community discussion yet for this question.