which class should you use?
You are building a client for a Windows Communication Foundation (WCF) service. You
need to create a proxy to consume this service which class should you use?
Which code segment should you use at line 10?
You are working with a Windows Communication Foundation (WCF) client application that
has a generated proxy named SampleServiceProxy. When the client application is
executing, in line 02 of the following code, the channel faults (Line numbers are included for
reference only.) 01 SampleServiceProxy proxy new SampleServiceProxy() 02try 03{
04proxy Processlnvoice(invoice); 05) 06catch 07{ 08 (proxy. State == CommunicationState.
Faulted) 09{ 10 11) 12) 13 proxy Update Customer(customer); You need to retumn proxy to
a state in which it can successfully execute the call in line 13. Which code segment should
you use at line 10?
You need to ensure that all calls to Operation 1 and Operation2 from the client are encrypted and signed
A Windows Communication Foundation (WCF) client uses the following service contract.
(Line numbers are included for reference only.) 01 [ServiceContract] 02 public interface
IService 03 ( 04 [OperationContractj 05 string Operation1O; 06 [OperationContract] 07
string Operation2(), 08) You need to ensure that all calls to Operation 1 and Operation2
from the client are encrypted and signed. What should you do?
You need to configure the service to run the operations under the correct identity
A Windows Communication Foundation (WCF) service exposes two operations: OpA and
OpB OpA needs to execute under the client’s identity, and OpB needs to execute under the
service’s identity. You need to configure the service to run the operations under the correct
identity. What should you do?
You need to ensure that all clients calling GetMessage will retrieve the same string, even if the message is u
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] 02public interface ITeamMessageService 03{ 04 [OperationContract]
05string GetMessage0;n 06 07 [OperationContract] 08void PutMessage(string message);
09) The code for the service class is as follows 10 public class TeamMessageService:
ITeamMessageService 1 1{ 12Guid key = GuicLNewGuidO; 1 3string message = “Today’s
Message”: 1 4public string GetMessage() i5{ 16 return stringFormat(”Message:{0} Key:{1}”,
message, Key); 1n 18 1 9public void PutMessage(string message) 20{ 2lthismessage =
message; 22} 23) The senvice is self-hosted. The hosting code is as follows. 24
ServiceHost host = 25BasicHttpBinding 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?
What should you do?
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> 02PuElic Interface ITeamMessageService 03 04
<OperationContractO> 05Function GetMessage() As String 06 07 <OperationContract0>
08Sub PutMessage(Byval message As String) O9End Interface The code for the serAce
class is as follows. 10 Public Class TeamMessageService0 11 Implements
lTearmt4essageService 12 1 3Dim key As Guid = Guid.NewGuid() 1 4Dim message As
String = “Today’s Message’ 15 16PuUic Function GetMessage0As String – 1 7lmpements
lTearm*AessageServiceGetMessage 18 1 9Retun String. Fommat(”Message:{0) Key:{ 1}”,
message, key) 20End Function 21 22PubIic Sub PutMessage(ByV message As Stnng) –
23lmpements lTearrlessageService PutMessage 24 25Me message = message 26End Sub
27 28End Class The service is self-hosted The hosting code rs as follows 29Dim host As
ServiceHost = New ServiceHost(GetType(TearrwiessageSeMce))? 3ODim binding As Basic
HttpBindngt New BasicHttpBindiig(BasicHttpSecurityMode. None) 31
host.AddServiceEndpoint( “MyAppication lTearrtAessageService”, binding Thttp /Ilac aihost.
1 2345) 32host 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?
You need to complete the implementation and ensure that the session-based counter will perform over HTTP as it
A Windows Communication Foundation (WCF) solution provides a session-based counter.
The service is self-hosted. The hosting code is as follows. Dim host As ServiceHost = New
ServiceHost(GetType(CounterService)) Dim bnding As NetTcpBinding = New
NetTcpBinding(SecurityMode.None) host.AddServiceEndpoint(”MyApplication.
ICounterService”, binding, “net.tcp://localhost:23456”) host. Open() This service is currently
exposed over TCP, but needs to be exposed to external clients over HTTP. Therefore, a
new service endpoint is created with the following code.
host.AddServiceEndpoint(‘’MyApplication. lCounterService”, binding2,
“http:/!localhost:12345’ You need to complete the implementation and ensure that the
session-based counter will perform over HTTP as it does over TCP. What should you do?