Latest MCTS 70-513 Dumps Real Exam Download 51-60

Ensurepass

QUESTION 51

A Windows Communication Foundation (WCF) service is generating a separate namespace declaration for each body member of a message contract,

even though all body members share the same namespace.

You need to simplify the XML representation of your message contract so that the namespace is only declared once. What should you do?

 

A. Declare a wrapper namespace for the message contract by using the WrapperNamespace property of the MessageContract attribute

B. Explicitly set the Namespace property of all the MessageBodyMember attrbutes to the same namespace.

C. Declare all of the body members as properties of a DataContract class and use the class as the only body member of the message contract.

D. Declare all of the body members as properties of a separate MessageContract class and use the class as the only body member of the message contract.

 

Correct Answer: C

Explanation/Reference:

 

 

QUESTION 52

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

Explanation/Reference:

The body of a Message instance can only be accessed or written once. If you want to access a Message instance more than once,

you should use the MessageBuffer class to completely store an entire Message instance into memory.

A MessageBuffer instance is constructed by calling CreateBufferedCopy of a Message instance.

Calling MessageBuffer.CreateMessage() method creates an identical copy of the original Message instance you previously provided to

the CreateBufferedCopy method of a Message instance. You can then save the message to a durable storage.

Message.CreateBufferedCopy Method

(http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.message.createbufferedcopy(v=vs.95).aspx)

MessageBuffer.CreateMessage Method

(http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.messagebuffer.createmessage.aspx)

Example:

private byte[] ConvertMessageToByteArray(ref Message message)

{ MemoryStream stream = new MemoryStream();XmlWriterSettings settings = new XmlWriterSettings();settings.Encoding = System.Text.Encoding.UTF8;XmlWriter writer = XmlWriter.Create(stream, settings);

MessageBuffer buffer = message.CreateBufferedCopy(int.MaxValue);

message = buffer.CreateMessage();

 message.WriteMessage(writer);

message = buffer.CreateMessage();

writer.Flush();

stream.Flush();

byte[] retval = stream.ToArray();

return retval;

}

 

 

QUESTION 53

You are creating a Windows Communication Foundation (WCF) service that responds using plain-old XML (POX). You have the following requirements:

You must enable the /catalog.svc IItems operation to respond using the POX, JSON, or ATOM formats.

You also must ensure that the same URL is used regardless of the result type.

You must determine the response format by using the Accepts HTTP header.

What should you do?

 

A. Implement the IChannelInitializerinterface in the service class.

B. Implement the System.Runtime.Serialization.IFormatterConverter interface in the service class.

C. Set the BodyStyle parameter of the WebGet attribute on the operation to WebMessageBodyStyle.WrappedResponse.

D. Set the retum type of the operation to System.ServiceModel.Channels.Message. Use the current WebOperationContext methods to return the data in the required format.

 

Correct Answer: D

Explanation/Reference:WebOperationContext A helper class that provides easy access to contextual properties of Web requests and responses.

WebOperationContext Class

(http://msdn.microsoft.com/en-us/library/system.servicemodel.web.weboperationcontext.aspx)

 

 

QUESTION 54

A Windows Communication Foundation (WCF) solution uses two services to manage a shopping cart.

Service A processes messages containing line items that total between $0 and $500.

Service B processes messages containing line items that total more than $500. All messages are of equal importance to the business logic.

You need to route incoming messages to the appropriate services by using WCF routing.

Which two message filters should you add to the router? (Each correct answer presents part of the solution. Choose two.)

 

A. a message filter with a priority of 100 that will forward messages that total between $0 and $500 to Service A

B. a message filter with a priority of 0 that will forward messages that total between $0 and $500 to Service A

C. a message filter with a priority of 0 that will forward all messages to Service B

D. a message filter with a priority of 100 that will forward all messages to Service B

 

Correct Answer: AC

Explanation/Reference:Message Filters

To implement content-based routing, the Routing Service uses MessageFilter implementations

that inspect specific sections of a message, such as the address, endpoint name, or a specific XPath statement.

If none of the message filters provided with .NET Framework 4 meet your needs,

you can create a custom filter by creating a new implementation of the base MessageFilter class.

When configuring the Routing Service, you must define filter elements (FilterElement objects) that describe the type of MessageFilter and any supporting data required to create the filter, such as specific string values to search for within the message. Note that creating the filter elements only defines the individual message filters; to use the filters to evaluate and route messages you must also define a filter table (FilterTableEntryCollection).

Each entry in the filter table references a filter element and specifies the client endpoint that a message will be routed

to if the message matches the filter. The filter table entries also allow you to specify a collection of backup endpoints (BackupEndpointCollection),

which defines a list of endpoints that the message will be transmitted to in the event of a transmission failure when sending to the primary endpoint.

These endpoints will be tried in the order specified until one succeeds.

Priority is applied from hight to low.

Routing Service

(http://msdn.microsoft.com/en-us/library/ee517423.aspx)

RoutingIntroduction

(http://msdn.microsoft.com/en-us/library/ee517422.aspx)

Message Filters

(http://msdn.microsoft.com/en-us/library/ee517424.aspx)

EXAMPLE:

<behaviors> <serviceBehaviors>

 <behavior name=”routingData”>

<serviceMetadata httpGetEnabled=”True”/>

<!– Add the RoutingBehavior and specify the Routing Table to use –>

<routing filterTableName=”routingTable1″ />

</behavior>

</serviceBehaviors></behaviors><!–ROUTING SECTION –> <routing>

<filters>

 <filter name=”MatchAllFilter1″ filterType=”MatchAll” />

<filter name=”RoundingFilter1″ filterType=”EndpointAddress”

filterData=”http://localhost:8000/routingservice/router/rounding” />

</filters>

<filterTables>

 <table name=”routingTable1″>

<filters>

 <add filterName=”MatchAllFilter1″ endpointName=”CalculatorService” />

<add filterName=”RoundingFilter1″ endpointName=”RoundingCalcService” />

</filters></table></filterTables></routing>

 

 

QUESTION 55

You have an existing Windows Communication Foundation (WCF) service. You need to ensure that other services are notified when the service is started. What should you do?

 

A. Add the following standard endpoint to the service.

<endpoint name=”udpAnnouncementEndpoint” kind=”udpDiscoveryEndpoint” />

B. Add the following standard endpoint to the service.

<endpoint name=”udpDiscoveryEndpoint” kind=”udpAnnouncementEndpoint” />

C. Add a service behavior with the following element.

<serviceDiscovery>

<announcementEndpoints>

<endpoint kind=”udpDiscoveryEndpoint” />

</announcementEndpoints>

</serviceDiscovery>

D. Add a service behavior with the following element.

<serviceDiscovery>

<announcementEndpoints>

<endpoint kind=”udpAnnouncementEndpoint” />

</announcementEndpoints>

</serviceDiscovery>

 

Correct Answer: D

Explanation/Reference:

A standard endpoint that is used by services to send announcement messages over a UDP binding.

This endpoint inherits from AnnouncementEndpoint and similarly has a fixed contract and supports two discovery versions.

In addition it has a fixed UDP binding and a default address value as specified in the WS-Discovery specifications (WS-Discovery April 2005 or WS-Discovery version 1.1).

Therefore, in the simplest case you do not have to specify any of these values when you create an AnnouncementEndpoint and add it to a service. eg: <serviceDiscovery> <announcementEndpoints> <endpoint kind=”udpAnnouncementEndpoint”/> </announcementEndpoints> </serviceDiscovery>

Configuring Discovery in Confiruration File

(http://msdn.microsoft.com/en-us/library/dd456792.aspx)

 

 

QUESTION 56

You are developing a Windows Communication Foundation (WCF) service that reads messages from a public non-transactional MSMQ queue.

You need to configure the service to read messages from the failed-delivery queue.

Which URI should you specify in the endpoint configuration settings of the service?

 

A. net.msmq://localhost/msmq$FailedMessages

B. net.msmq://localhost/msmq$DeadLetter

C. net.msmq://localhost/system$DeadXact

D. net.msmq://localhost/system$DeadLetter

 

Correct Answer: D

Explanation/Reference:

To read messages from a system non-transactional dead-letter queue, the URI must be of the form: net.msmq://localhost/system$DeadLetter.

Using Dead-Letter Queues to Handle Message Transfer Failures

(http://msdn.microsoft.com/en-us/library/ms789035.aspx)

 

 

QUESTION 57

You have an existing Windows Communication Foundation (WCF) service that exposes a service contract over HTTP. You need to expose that contract over HTTP and TCP. What should you do?

 

A. Add a net.tcp base address to the host.

B. Add an endpoint configured with a netTcpBinding.

C. Add an endpoint behavior named netTcpBehavior to the existing endpoint.

D. Add a binding configuration to the existing endpoint named netTcpBinding.

 

Correct Answer: B

Explanation/Reference:

<system.serviceModel><services> <service behaviorConfiguration=”WcfServiceLibrary1.Service1Behavior” name=”WcfServiceLibrary1.Service1″><endpoint address=”” binding=”netTcpBinding” bindingConfiguration=”” contract=”WcfServiceLibrary1.IService1″><identity><dns value=”localhost” />

</identity></endpoint><endpoint address=”mex” binding=”mexTcpBinding” bindingConfiguration=”” contract=”IMetadataExchange” /><host>

 <baseAddresses>

 <add baseAddress=”net.tcp://localhost:8523/Service1″ />

</baseAddresses>

</host>

</service>

</services>

<behaviors>

 <serviceBehaviors>

 <behavior name=”WcfServiceLibrary1.Service1Behavior”>

<serviceMetadata httpGetEnabled=”false” />

<serviceDebug includeExceptionDetailInFaults=”false” />

</behavior>

</serviceBehaviors>

</behaviors>

</system.serviceModel>

 

 

QUESTION 58

You have an existing Windows Communication Foundation (WCF) Web service. The Web service is not responding to messages larger than 64 KB. You need to ensure that the Web service can accept messages larger than 64 KB without generating errors. What should you do?

 

clip_image002

 

Correct Answer: A

Explanation/Reference:WSHttpBindingBase.MaxReceivedMessageSize Property

Gets or sets the maximum size for a message that can be processed by the binding.

Type: System.Int64

The maximum size, in bytes, for a message that is processed by the binding. The default value is 65,536 bytes.

 

 

QUESTION 59

A Windows Communication Foundation (WCF) service is responsible for transmitting XML documents between systems. The service has the following requirements:

It must minimize the transmission size by attaching the XML document as is without using escape characters or base64 encoding.

It must interoperate with systems that use SOAP but are not built on the .NET plafform.

You need to configure the service to support these requirements. Which message encoding should you use?

 

A. Binary message encoding

B. MTOM (Message Transmission Optimization Mechanism) message encoding

C. Text message encoding with message version set to none

D. Text message encoding with message version set to SOAP 1.2

 

Correct Answer: B

Explanation/Reference:

MTOM

SOAP Message Transmission Optimization Mechanism

MTOM describes a mechanism for optimizing the transmission and/or wire format of a SOAP message by

selectively re-encoding portions of the message while still presenting an XML Infoset to the SOAP application.

MTOM also describes an Inclusion Mechanism that operates in a binding-independent way, plus a specific binding for HTTP.

 

 

QUESTION 60

You are moving a Windows Communication Foundation (WCF) service into production. You need to be able to monitor the health of the service.

You only want to enable all performance counter instances exposed by the ServiceModelService counter group.

Which element should you add to the system.serviceModel section in the application configuration file?

 

A. <diagnostics performanceCounters=”ServiceOnly” />

B. <diagnostics wmiProviderEnabled=”true” performanceCounters=”Off” />

C. <diagnostics performanceCounters=”All” />

D. <diagnostics wmiProviderEnabled=”true” />

 

Correct Answer: A

Explanation/Reference:

You can enable performance counters for a WCF service through the app.config configuration file of the WCF service as follows:

<configuration><system.serviceModel><diagnostics performanceCounters=”All” /></system.serviceModel></configuration>

The performanceCounters attribute can be set to enable a specific type of performance counters. Valid values are All All category counters (ServiceModelService, ServiceModelEndpoint and ServiceModelOperation) are enabled. ServiceOnly Only ServiceModelService category counters are enabled. Off ServiceModel* performance counters are disabled. This is the default value.

Performance Counters

(http://msdn.microsoft.com/en-us/library/ms735098.aspx)

 

 

Download Latest MCTS 70-513 Real Free Tests , help you to pass exam 100%.