Ensurepass

QUESTION 171

You are developing a Windows Communication Foundation (WCF) service to provide an in- memory cache for many Web applications. The service contract is defined as follows. (Line numbers are included for reference only.)

 

01 <ServiceContract()>

 

02 Public Interface IDataCache

 

03

 

04 . . .

 

05 End Interface

 

06

 

07

 

08 Public Class DataCache

 

09 Implements IDataCache

 

10

 

11 . . .

 

12 End Class

 

You need to ensure that all users share the cache.

 

Which code segment should you insert at line 07?

 

A.

<ServiceBehavior (InstanceContextMode : =

InstanceContextMode.PerSession)>

B.

<ServiceBehavior(TransactionIsolationLevel:=

IsolationLevel.RepeatableRead)>

C.

<ServiceBehavior(TransactionIsolationLevel:=

IsolationLevel.ReadCommitted)>

D.

<ServiceBehavior(InstanceContextMode:=

InstanceContextMode.Single)>

 

Correct Answer: D

 

 

 

 

 

 

 

QUESTION 172

Windows Communication Foundation (WCF) application uses a data contract that has several data members. You need the application to throw a Serialization Exception if any of the data members are not present when a serialized instance of the data contract is deserialized. What should you do?

 

A.

Add the Known Type attribute to the data contract. Set a default value in each of the data member declarations.

B.

Add the Known Type attribute to the data contract. Set the Order property of each data member to unique integer value.

C.

Set the Emit Default Value property of each data member to false.

D.

Set the lsRequired property of each data member to true.

 

Correct Answer: D

 

 

QUESTION 173

You are creating a client application and configuring it to call a Windows Communication Foundation (WCF) service. When the application is deployed, it will be configured to send all messages to a WCF routing service. You need to ensure that the application can consume the target service after the application is deployed. What should you do?

 

A.

In the client application, add a service reference to the router service. In the client binding configuration, specify the address of the router service.

B.

In the client application, add a service reference to the target service. In the client binding configuration, specify the address of the target service.

C.

In the client application, add a service reference to the router service. In the client binding configuration, specify the address of the target service.

D.

In the client application, add a service reference to the target service. In the client binding configuration, specify the address of the router service.

 

Correct Answer: D

 

 

QUESTION 174

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″/>

 

Correct Answer: D

Explanation:

To log malformed message we should set logMalformedMessages=”true”, only D met this requirement.

 

 

QUESTION 175

You are developing a Windows Communication Foundation (WCF) service that is hosted by a Windows Forms application. The ServiceHost instance is created in the Form constructor. You need to ensure that the service is not blocked while the UI thread is busy. What should you do?

 

A.

Decorate the service implementation class with the following line of code:

[ServiceBehavior(

UseSynchronizationContext = false)]

B.

Decorate the service implementation class with the following line of code:

[ServiceBehavior(

ConcurrencyMode = ConcurrencyMode.Multiple)]

C.

Call the Invoke method of the form and supply a delegate.

D.

Call the BeginInvoke method of the form and supply a delegate.

 

Correct Answer: A

 

 

QUESTION 176

A Windows Communication Formation (WCF) client and service share the following service contract interface

 

<ServiceContractO>

 

Public Interface IContosoService <OperationContractO>

 

Sub SasePerson(BWal person As Person) End Interface They also use the following binding.

 

Dim binding As NetTcpBinding = New NetTcpBinding With {TransactionFlow = True) The client cals the service with the (following code using (mransactionScope ts = new TransactionScope(TransactionScopeOption

 

Required))

 

{

 

IContosoService client = factoryCreateChannelO;

 

client SavePerson(person);

 

Consde. WriteLine(

 

Transaction. CurreriTransactioninformation

 

DistnbutedldentifierX

 

ts CorrpleteO;

 

)

 

The service has the following impementation for SavePerson

 

Public Sub SavePerson(ByVal person As Perwn) — implements IContosoService SavePerson person Save()

 

ConsdeWriteLine(Transaction .Current Transactionlnformaiona

 

Distributedldentifier)

 

End Sit

 

The distributed identifiers do not match on the client and the server.

 

You need to ensure that the client and server enlist in the same distributed transaction

 

What should you do?

 

A.

Add the following attributes to the SavePerson operation on lContosoService

eOperationBehavior(TransactionSc opeRequired =True)>

<TransactionFlow(TransactionFbwOption Madatory)>

B.

Add the following attributes to the SavePerson operation on IContosoSewvice

<TransactionFlow(TransactionFbwOption Maidatory)>

eOperationBehavior(TransactionSc opeRequired zTrue)>

C.

Add the following attribute to the SavePerson operation on KContosoService.

<OperationBehavior(TransachonSc opeRequired True)>

Add the following attribute to the implementation of SavePeson.

<TransactionFlow(TransactionFbwOption

Allowed)>

D.

Add the following attribute to the SavePerson operation on KOontosoService.

<TransactionFlow(TransactionFbwOption Allowed)>

Add the following attribute to the implementation of SavePeson.

eOperationBehavior(TransactionSc

opeRequired True)>

 

Correct Answer: D

 

 

QUESTION 177

You are developing a Windows Communication Foundation (WCF) service. The following code defines and implements the service. (Line numbers are included for reference only.)

 

clip_image001

 

You need to ensure that two identical copies of the received message are created in the service.

 

Which code segment should you insert at line 14?

 

A.

Dim msgCopy As Message = TryCast(

TryCast(message.CreateBufferedCopy(8192), Object), Message)

Dim returnMsg As Message = TryCast(

TryCast(message.CreateBufferedCopy(8192), Object), Message)

B.

Dim buffer As MessageBuffer = message.

CreateBufferedCopy(8192)

Dim msgCopy As Message = buffer.CreateMessage()

Dim returnMsg As Message ?msgCopy

C.

Dim msgCopy As Message = message

Dim returnMsg As Message = message

D.

Dim buffer As MessageBuffer = message.

CreateBufferedCopy(8192)

Dim msgCopy As Message = buffer.CreateMessage()

Dim returnMsg As Message = buffer.CreateMessage()

 

Correct Answer: B

 

 

 

QUESTION 178

DRAG DROP

You are developing a Windows Communication Foundation (WCF) service that contains a method named ProcessPayments. The service is hosted in Internet Information Services (IIS).

 

You have the following requirements:

 

clip_image003Create a new instance of the service every time that a client application calls the ProcessPayments method.

clip_image003[1]Process every call from client applications one at a time.

 

You need to complete the code for the WCF service.

 

Which four code segments should you use in sequence? (To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.)

 

clip_image005

 

Correct Answer:

clip_image007

 

 

QUESTION 179

A Windows Communication Foundation (WCF) application exposes a service as a SOAP endpoint for consumption by cross-platform clients. During integration testing, you find that one of the clients is not generating the correct messages to the WCF application. In order to debug the issue and fix the communication, you need to configure the service to log messages received from the client. What should you do?

 

A.

Set an etwTracking behavior on the service and configure a listener for the System.ServiceModel trace source.

B.

Set an etwTracking behavior on the service and configure a listener for the System.ServiceModel.MessageLogging trace source.

C.

Enable messageLogging in the System.ServiceModel diagnostics element configuration and configure a listener for the System.ServiceModel.MessageLogging trace source.

D.

Enable messageLogging in the System.ServiceModel diagnostics element configuration and configure a listener for the System.ServiceModel trace source.

 

Correct Answer: C

 

 

 

 

 

QUESTION 180

DRAG DROP

You are developing a Windows Communication Foundation (WCF) service that contains a method named ProcessPayments. The service is hosted in Internet Information Services (IIS).

 

You have the following requirements:

 

clip_image003[2]Create a new instance of the service every time that a client application calls the ProcessPayments method.

clip_image003[3]Process every call from client applications one at a time.

 

You need to complete the code for the WCF service.

 

Which four code segments should you use in sequence? (To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order.)

 

clip_image009

 

Correct Answer:

clip_image011

 

 

Instant Access to Download Latest Complete Collection of Microsoft 70-513 Real Exam

Try Microsoft 70-513 Free Demo