Mar 2021 updated: Exambible Microsoft 70-513 exam question 226-240

Question No. 226

You are developing a Windows Communication Foundation (WCF) service. You establish that the largest size of valid messages is 8,000 bytes. You notice that many malformed messages are being transmitted. 

Detailed information about whether each message is malformed must be logged. 

You need to ensure that this information is saved in XML format so that it can be easily analyzed. 

What should you add to the service configuration file? 

A. <messageLogging logMessagesAtServiceLevel="true" logMessagesAtTransportLevels"true" maxMessagesToLog="1000" maxSizeOfMessageToLog="8000"/> 

B. <roessageLogging logEntireMessage="true" logNalformedMessages="false" logMessagesAtServiceLeve1="true" logMessagesAtTransportLevel="true" maxMessagesToLog""1000"/> 

C. <message Logging logEntireMessage="true" logHalformedMessages""false" logMessagesAtServiceLevel-"true" logMessagesAtTransportLevel-"true" maxMessagesToLog="1000" maxSizeOfMessageToLog="8000"/> 

D. <messageLogging logEnt ireMessage="true" logHalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTranspoctLevel="true" maxMessagesToLog="1000" maxSizeOfMessageToLog="100000"/> 

Answer:


Question No. 227

You are developing a data contract for a Windows Communication Foundation (WCF) service. 

The data in the data contract must participate in round trips. Strict schema validity is not required. 

You need to ensure that the contract is forward-compatible and allows new data members to be added to it. 

Which interface should you implement in the data contract class? 

A. ICommunicationObject 

B. IExtension(Of T) 

C. IExtensibleObject(Of T) 

D. IExtensibleDataObject 

Answer:


Question No. 228

HOTSPOT 

You are developing a Windows Communication Foundation (WCF) service. You implement a data contract to pass complex data to and from the service. 

The service includes the following code: You need to verify the order in which the data is serialized. 


Answer: 


Question No. 229

You are developing a Windows Communication Foundation (WCF) service that does not operate on a duplex channel. 

You find that operations do not start until all previous operations have finished. The service hosting code contains the following lines. 

Dim service = New WarehouseService() 

Dim hose = New ServiceHost(service) 

You need to ensure that new operations do not wait for previous operations to finish. 

Which attribute should you use to decorate the service? 

A. <ServiceBehavior( InstanceContextMode:=InstanceContextMode.Single, ConcurrencyMode:=ConcurrencyMode.Single) > 

B. <CallbackBehavior( ConcurrencyMode:=ConcurrencyMode.Multiple)> 

C. <ServiceBehavior( InstanceContextMode:=InstanceContextMode.Single, ConcurrencyMode:=ConcurrencyMode.Reentrant)> 

D. <ServiceBehovior( InstanceContextMode:=InstanceContextMode.Single, ConcurrencyMode:=ConcurrencyMode.Multiple)> 

Answer:


Question No. 230

The following is an example of a SOAP envelope. 

<s:Enelope xmlns:se’http://schemas.xmlsoporg/soap/envelopef’> 

<s: Header> <h:Storeld xmlns:he"http:/!www.contoso.com”s 

<Ih: Storeld> 

</s:Header> 

<s:Body> 

<CheckStockRequest xmlnsehttp://wwwcorIosocom”> 

<ltemld>2469 <Iltenld>4 

</CheckStoc kRequest> 

<Is: Body> 

<Is: Envelope> 

You need to create a message contract that generates the SOAP envelope. 

1 which code segment should you use? 

A. [MessageContract(WrapperName=”http:I/www. contoso. comn”)] 

public class CheckStockRequest { 

[MessageHeader(Nanez"http:llwww.contoso.com”)] public mnt Storeld{get; set.} 

[MessageBodyMember(Namee’intp://www..contoso.com”)] public nit itemld{get set;) 

B. [MessageContract(WrapperNamespace="http:I/www.contoso.comn”)] public class 

CheckStoc kRequest 

[MessageHeader(Namespaces"http:I/www.contosocom”)]o 

public nmt Storeld{get; set;) 

[MessageBodyMember(Namespaces”http://www. contoso . comn”)] 

public nmt ltemld{get; set;} 

C. [MessageContract(WrapperNamespace=”http://www. contosocom”)] pi±lic class 

CheckStockRequest 

[MessageHeader(Na-mespacesttp://wwwcontoso. comn")] 

public mnt Storeld{get set.} 

public mnt ltemld{get: set;} 

D. (MessageContract(WrapperNamespace=”httpJ/www. contoso.com”)] public class 

CheckStockRequest 

[MessageHeader(Namespace11tp:IIwww. contoso. comn")] 

public int Storeld{get set;} 

(MessageBodyMember] 

public int ltemmld(get set} 

Answer:


Question No. 231

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? 

A. Define binding2 as follows. 

Dim binding2 As WS2007HttpBinding = 

New WS200lHttpBinding(SecurityMode. None) Configure binding2 as follows. 

binding2.ReliableSession.Enabled = True 

B. Define binding2 as follows. 

Dim binding2 As WSHttpBinding = — New WSHttpBinding(SecurityMode.None) Add the 

following behavior to the service implementation. <ServceBehavior(lnstanceContextMode: 

1nstanceContextMode.PerSession)s 

C. Define binding2 as follows. 

Dim binding2 As BasicHttpBinding = New BasicHttpBinding(BasicHttpSecurityMode.None) 

Enable cookies for 

binding2. 

binding2.AllowCookies = True 

D. Define binding2 as follows. 

Dim binding2 As BasicHttpBinding = New BasicHttpBinding(BasicHttpSecurityMode. None) 

add the following behavior to the service implementation. 

<ServiceBehavior(lnstanceContextMode: 

1nstanceContextMode.Single)> 

Answer:


Question No. 232

You create a Windows Communication Foundation (WCF) service and deploy it with wsHttpBinding and message security enabled. 

You create an intermediate WCF service for logging messages sent to the primary service. The intermediate service is called via the clientVia endpoint behavior. 

The primary service is receiving malformed data from a client application. 

You need to enable inspection of the malformed data and prevent message tampering. 

What should you do? 

A. Specify a protection level of None in the service contract for the intermediate service. Disable message and transport security from the client application configuration file. 

B. Specify a protection level of Sign in the service contract for the intermediate service. Disable transport security from the client application configuration file. 

C. Modify the binding on the intermediate service to use netNamedPipeBinding. 

D. Modify the binding on the intermediate service to use webHttpBinding. 

Answer:


Question No. 233

DRAG DROP 

You are creating a Windows Communication Foundation (WCF) service. 

The service must be able to transmit messages back to the client application. 

You need complete the web.config file for the service. 

How should you complete the relevant markup? (To answer, drag the appropriate markup segments to the correct location or locations in the answer area. Each markup segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.) 


Answer: 


Question No. 234

You are creating a Windows Communication Foundation (WCF) service that is implemented as folks. (Line numbers are included for reference only.) 

01 <ServiceContract() 

02<ServiceBehaior(lncludeExceptionDetailInFaults: Time)> 

03Public Class OrderService 

04 

05eCNperationCortracto()> 

O6Putdic Sub Submit Order(ByVal anOrder As Order) 

07 

08Try 

09. 10Catch ex As D wide By Zero Exception 11 12End Try 13End Sub 14 1 5End Class 

You need to ensure that the sack trace details of the exception are not included in the error information sent to the client. What should you do? 

A. Replace line 11 with the following line. 

Throw 

B. Replace line 11 with the following line. 

Throw New FaultException(C Order)(anOrder, exToSthng0)d 

C. After line 05, add the following line. 

‘cFaultContract(GetType(FautException(Of Order)))> 

Replace line 11 with the following line. 

Throw ex 

D. After line 05, add the following line. 

<FaultContract(GetType(FaultException(CX Order)))> 

Replace line 11 with the following line. 

Throw New FaultException(CX Order)( 

anOrder, “Divide by zero exception”) 

Answer:


Question No. 235

You are hosting a Windows Communication Foundation (WCF) service at http://www.contoso.com for a law enforcement agency. The agency adds operations to support sending biometric fingerprint data via non-buffered streaming. The service data is not routed between intermediaries. 

The WCF binding you are using by default does not support encryption. 

You need to ensure that fingerprint data is not disclosed when it is passed over the network. 

What should you do? 

A. Use basicHttpBinding with message security to https://www.contoso.com. 

B. Use basicHttpBinding over transport security at https://www.contoso.com. 

C. Use wsHttpBinding over message security at https://www.contoso.com. 

D. Use wsHttpBinding over transport security at http://www.contoso.com. 

Answer:


Question No. 236

A Windows Communication Foundation (WCF) client configuration file contains the following XML segment in the system.serviceModel element. 

<client> 

<endpoint address=" net.tcp://server/ContosoService " 

binding=" netTcpBinding " 

contract=" Contoso. IContosoService " 

name=" netTcp " / > 

<endpoint address=" net.pipe://localhost/ContosoService " 

binding=" netNamedPipeBinding " 

contract=" Contoso. IContosoService " 

name=" netPipe " /> 

</client> 

You need to create a channel factory that can send messages to the endpoint listening at net.pipe://localhost/ContosoService. 

Which code segment should you use 

A. ChannelFactory < Contoso. IContosoService > factory = 

new ChannelFactory < Contoso. IContosoService >(" Contoso. IContosoService "); 

B. ChannelFactory < Contoso. IContosoService > factory = 

new ChannelFactory < Contoso. IContosoService >(" netNamedPipeBinding "); 

C. ChannelFactory < Contoso. IContosoService > factory = 

new ChannelFactory < Contoso. IContosoService >(" netPipe "); 

D. ChannelFactory < Contoso. IContosoService > factory = 

new ChannelFactory < Contoso. IContosoService >( 

" net.pipe://localhost/ContosoService "); 

Answer:


Question No. 237

A Windows Communication Foundation (WCF) service uses the following service contract. 

[ServiceContract] 

public interface IService 

[OperationContract] 

string Operation 1 (string s); 

You need to ensure that the operation contract Operationi responds to HTTP POST requests. 

Which code segment should you use? 

A. [OperationContract| [Weblnvoke(Method POST)] string Operationl(string s); 

B. [OperationContract| [WebGet(UriTemplate = POST’)] string Operation 1 (string s); 

C. [OperationContract(ReplyAction z ‘POST’)J string Operationi (string s); 

D. [OperationContract(Action WPOST)1 string Operationl(string s); 

Answer:


Question No. 238

You are configuring services to be discoverable. The services must be discoverable without relying on a central server. Client applications that consume the services are on a network segment that is separate from the network segment that the services are located on. 

A firewall blocks all TCP ports between the two network segments, but allows other protocols to pass through. 

You need to ensure that the client applications can discover the services. 

What should you do? 

A. Use ad-hoc discovery mode over HTTP. 

B. Use ad-hoc discovery mode over UDP. 

C. Use managed discovery mode over HTTP. 

D. Use managed discovery mode over UDP. 

Answer:


Question No. 239

You create a Windows Communication Foundation (WCF) sen/ice. It is deployed on Microsoft Internet Information Services (IIS) with an application pool running as Network Service. You enable WMI tracing before launching the service. Your IT support staff adds WMI data collection through ASP.NET WMI tracing. 

You need to restrict the collection of WMI data to a privileged account. 

What should you do in WMI Control in the Computer Management console? 

A. Select the Rootaspnet namespace. 

Remove Enable account permission for the Network Service account. 

Add a custom user and grant that user Enable account permission. 

B. Select the Rootaspnet namespace. 

Remove Enable account permission for the Local System account. 

Add a custom user and grant that user Enable account permission. 

C. Select the RootSecurity namespace. 

Remove Enable account permission for the Local System account. 

D. Select the RootServiceModel namespace. 

Remove Enable account permission for the Network Service account. 

Add a custom user and grant that user Enable account permission. 

Answer:


Question No. 240

A Windows Communication Foundation (WCF) service has the following contract. 


This is one of several service contracts hosted by your application. All endpoints use SOAP 

1.2 bindings with WS-Addressing 1.0. The System.ServiceModel.MessageLogging trace source in the system.diagnostics configuration section is configured with one listener. 

You need to make sure that only the messages that are returned from the DoWork operation are logged. 

Which XML segment should you add to the 

system.serviceModel/diagnostics/messageLogging/filters configuration element? 

A. odd xmlns:soap="http://www.u3.org/2003/05/soap-envelope"> 

//soap:Action[text() = 

'http://contoso.com/I5hipping/DoWorkResponse'] 

</add> 

B. <odd xmlns:addr-"http://vww.w3.org/2005/08/addressing"> 

//addr:Action[text() -

‘http://contoso.com/IShipping/DoWorkResponse' ] 

</add> 

C. <add xmlns:addr="http://www.w3.org/2005/Q8/addressing"> 

//addr:Action[text() = 

'http://contoso.com/IShipping/DoUork' ] 

</add> 

D. <add xmlns:soap."http://www.w3.org/2003/05/soap-envelope"> 

//soap:Action[text() = 

1http://contoso.com/I3hipping/DoWork'] 

</add> 

Answer: