Ensurepass

QUESTION 101

You are developing a Windows Communication Foundation (WCF) service that must be discoverable. You need to ensure that the ServiceHost instance supports multiple discovery versions. What should you do?

 

A.

Specify a unique DiscoveryVersion parameter for each endpoint constructor.

Use the same value for the Address property of each endpoint.

B.

Use the endpoint constructor without the DiscoveryVersion parameter.

Use a unique value for the Address property of each endpoint.

C.

Specify a unique DiscoveryVersion parameter for each endpoint constructor.

Use a unique value for the Address property of each endpoint.

D.

Use the endpoint constructor without the DiscoveryVersion parameter.

Use the same value for the Address property of each endpoint.

 

Correct Answer: C

Explanation:

We should specify version discovery for each endpoint constructor and use unique addresses for them.

http://msdn.microsoft.com/en-us/library/dd456799.aspx

 

 

QUESTION 102

You are developing a Windows Communication Foundation (WCF) service. You write a method named Submit that accepts messages of the type System.ServiceModel.Channels.Message. You need to process the body of the incoming messages multiple times in the method. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

 

A.

Use the GetBody method of the Message class to read the content of the messages.

B.

Use the CreateBufferedCopy method of the Message class to load the messages into memory.

C.

Use the WriteBodyContents method of the BodyWriter class to make a copy of the messages.

D.

Use the CreateMessage method of the MessageBuffer class to make a copy of the messages.

 

Correct Answer: BD

 

 

QUESTION 103

You have a Windows Communication Foundation (WCF) service that accepts the following message contract.

 

clip_image001

 

You need to ensure that the client sends a SOAP body that is accepted by the service.

 

A.

<Ticket xmlns=”http://www.movies. com”>

<NumberOfSeats

xmlns=”http : //www.movietheater . com”>

0

</NumberOfSeats>

<ReservationName xmlns=”http://www.movietheater .com” />

<ShowTime

xmlns=”http://www.movietheater.com”>

2010-07-05T00:SI:10.0999304-05:00

</ShowTime>

</Ticket>

B.

<Ticket xmlns=”http://www.movietheater.com”>

<ShowTime

xmlns=”http : //www.movietheater . com”>

2010-07-05T00:51:10.0999304-05:00

</ShowTime>

<ReservationName xmlns=”http://www.movietheater.com” />

<NumberOfSeats

xmlns=”http://www.movietheater.com”>

0

</NumberOfSeats>

</Ticket>

C.

<Ticket xmlns=”http://wwv.movies.com”>

<ShowTime

xmlns-“http://www.movietheatec.com”>

2010-07-05TOO:51:10.0999304-05:00

</ShowTime>

<Number Of Seats

xmlns=”http://www.movietheater.com”>

0

</NumbecOfSeats>

<ReservationName xmlns””http://www.movietheotec.com” />

</Ticket>

D.

<Ticket xmlns=”http://www. movietheatec.com”>

<ShowTime

xmlns-“http://www.movietheater.com”>

2010-07-05TOO:51:10.0999304-05:00

</ShowTime>

<NumberOfSeats

xmlns=”http://wwv.movietheatec.com”>

0

</NumberOfSeats>

<ReservationName

xmlns=”http://www.movletheatec.com” />

</Ticket>

 

Correct Answer: C

 

 

QUESTION 104

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

 

[ServiceContract]

 

public class ContoaServicea

 

{

 

[OperationContract] [TransactionFlow(TransactionFlowOperation. Mandatory)]

 

[OperationBehavior(TraisactionScopeRequired true,

 

TransactionAutoCorrolete = false)

 

void TxOp 1 (string value) { ) [OperationCortract(lsTerminating–true)]

 

[TransactionFlow(TransactionFlowOption Mandatory)] [OperationBehavior(TraisactionScopeRequired true,

 

TransationAutoCormplete = false)]

 

void TxOp2(string value) {.. OperationContext. Current. SetTransactionCompleteO;

 

)

 

)

 

The rvice and the clients that call the service use NetTcpBinding with transaction flow enabled.

 

You need to configure the service so that when TxOpl and TxOp2 are invoked under the same client session, they run under the same transaction context.

 

What should you do?

 

A.

Update the service contract to read as follows:

(ServiceContract(SessionMode SessionMode Required)]

Add the following behavior to the service implementation

[ServiceBehavior(lnstanceCoritextMode = Instance ContextMode. PerSession)]

B.

Update the service contract to read as follows:

[ServiceContract(SessionMode = SessionModeAllowed)]

Add the following behavior to the service implementation.

[ServiceBehavior(LnstanceContextMode = Instance ContextMode Single,

ReleaseServicelnstanceQnTransactionComplete false)]

C.

Update the service contract to read as follows:

[ServiceContract(SessionMode = SessionMode.Allowed)]

Add the following behavior to the service implementation.

[ServiceBehavior(lnstanceContextMode Instance ContextMode. Single)]

D.

Update the service contract to read as follows:

[ServiceContract(SessionMode = SessionMode.Required)]

Add the following behavior to the service implementation.

[ServiceBehavior(lnstanceContextMode = lnstanceContextMode. PerCall)]

 

Correct Answer: A

 

 

QUESTION 105

A service implements the following contract. (Line numbers are included for reference only.)

 

clip_image003

 

The service is implemented as follows.

 

clip_image004

 

ContosoService uses NetMsmqBinding to listen for messages. The queue was set up to use transactions for adding and removing messages.

 

You need to ensure that OperationOne and OperationTwo execute under the same transaction context when they are invoked in the same session.

 

What should you do?

 

A.

Insert the following attribute to OperationOne on IContosoService.

[TransactionFlow(TransactionFlowOption.Mandatory)]

Insert the following attribute to OperationTwo on IContosoService.

[TransactionFlow(TransactionFlowOption.Mandatory)]

B.

Insert the following attribute to OperationOne on ContosoService.

[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = false)]

Insert the following attribute to OperationTwo on ContosoService.

[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]

C.

Add the following XML segment to the application config file in the system.serviceModel/bindings configuration section.

<netMsmqBinding>

<binding name=”contosoTx” durable=”true” receiveContextEnabled=”true” />

</netMsmqBinding>

Then use the NetMsmqBinding named contosoTx to listen for messages from the clients.

D.

Add the following XML segment to the application config file in the system.serviceModel/bindings configuration section.

<customBinding>

<binding name=”contosoTx”>

<transactionFlow />

<binaryMessageEncoding />

<msmqTransport durable=”true” />

</binding>

</customBinding>

Then use the CustomBinding named contosoTx to listen for messages from the clients.

 

Correct Answer: B

 

 

QUESTION 106

You have a secured Windows Communication Foundation (WCF) service. You need to track unsuccessful attempts to access the service. What should you do?

 

A.

Set the serviceAuthorizationManagerType attribute of the serviceAuthorization behavior to Message.

B.

Set the includeExceptionDetaillnFaults attribute of the serviceDebug behavior to true.

C.

Set the Mode attribute of the security configuration element to Message.

D.

Set the messageAuthenticationAuditLevel attribute of the serviceSecurityAudit behavior to Failure.

 

Correct Answer: D

 

 

QUESTION 107

A Windows Communication Foundation (WCF) service is required to log all authorization attempts to the Windows Event Log. You need to configure a behavior and apply it to the service to support this requirement. Which behavior should you configure and apply?

 

A.

serviceAuthenticationManager

B.

serviceAuthorization

C.

serviceCredentials

D.

serviceSecurityAudit

 

Correct Answer: D

 

 

 

QUESTION 108

A Windows Communication Foundation (WCF) service is self-hosted in a console application.

 

The service implements the IDataAccess contract, which is defined in the MyApplication namespace.

 

The service is implemented in a class named DataAccessService, which implements the IDataAccess interface and also is defined in the MyApplication namespace.

 

The hosting code is as follows. (Line numbers are included for reference only.)

 

01 static void Main(string[] args)

 

02 {

 

03 ServiceHost host;

 

04

 

05 host.Open();

 

06 Console.ReadLine();

 

07 host.Close();

 

08 }

 

You need to create a ServiceHost instance and assign it to the host variable. You also need to instantiate the service host.

 

Which line of code should you insert at line 04?

 

A.

host = new ServiceHost(“MyApplication.DataAccessService”);

B.

host = new ServiceHost(“MyApplication.IDataAccess”);

C.

host = new ServiceHost(typeof(IDataAccess));

D.

host = new ServiceHost(typeof(DataAccessService));

 

Correct Answer: D

 

 

QUESTION 109

You are consuming a Windows Communication Foundation (WCF) service. The service interface is defined as follows.

 

<DataContract(Namespace:=””)> Public Class Item

 

End Class

 

ServiceContract (Namespace: =””) > Public Interface ICatalog

 

<OperationContract()>

 

<WebInvoke(Method:=”POST*’, UriTemplate:=”/Item”) >

 

Function Updateltem(ByVal item As Item) As Item

 

End Interface

 

The client application receives a WebResponse named response with the response from the service.

 

You need to deserialize this response into a strongly typed object representing the return value of the method.

 

Which code segment should you use?

 

A.

Dim r As XmlDictionaryReader =

JsonReaderUriterFactory.CreateJsonReader(

response.GetResponseStream(),

XmlDictionaryReaderQuotas.Max)

Dim s As DataContractSerializer =

New DataContractSerializer(GetType(Item)

Dim item As Item = DirectCast(s.ReadObject(r), Item)

B.

Dim s As DataContractSerializer =

New DataContractSerializer(GetType(Item))

Dim item As Item –

DirectCast(s.ReadObject(response.GetResponsestrearn()), Item)

C.

Dim s As DataContractJsonSerlalizer =

New DataContractJsonSerlalizer(

GetType(Item))

Dim item As Item =

DirectCast(s.ReadObject(

response.GetResponsestrearn()), Item)

D.

Dim f As BinaryFormatter = New BinaryFormatter()

Dim item As Item =

DirectCast(f-Deserialize(response.GetResponsestream()), Item)

 

Correct Answer: C

 

 

QUESTION 110

You are developing a client application that consumes a Windows Communication Foundation (WCF) service. The operation contract is as follows.

 

[OperationContract]

 

[FaultContract(typeof(SalesFault))]

 

string GetSales(string saleld);

 

The service configuration file contains the following line in the serviceBehaviors section.

 

<behavior>

 

<serviceDebug inc1udeExceptionDetoillnFauIts-“True”/>

 

</behavior>

 

A divide-by-zero exception is not being handled by the service.

 

You need to ensure that the exception is caught in the client application.

 

Which type of exception should the client catch?

 

A.

TimeoutException

B.

FaultException

C.

DivideByZeroException

D.

FaultException<SalesFault>

 

Correct Answer: B

Explanation:

Because of DivideByZero exception not included into fault contract, on the client we should catch it as general fault exception

 

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

Try Microsoft 70-513 Free Demo

Comments are closed.