Latest MCTS 70-513 Dumps Real Exam Download 101-110

Ensurepass

QUESTION 101

You are developing a Windows Communication Foundation (WCF) service that contains the following operation contract.

[OperationContract]CustomerNames GetCustomerNames();

The operation returns customer names. You need to develop a definition for the operation contract that produces XML with the following structure.

<s:Envelope xmlns:s=”http://schemas.xmlsoap.org/soap/envelope/”><s:Header /><s:Body>

<Names xmlns=http://tempuri.org/xmlns:a=”http://schemas.microsoft.com/2003/10/Serialization/Arrays”xmlns:i=”http://www.w3.org/2001/XMLSchema-instance”>

<a:string>Customer1</a:string><a:string>Customer2</a:string><a:string>Customer3</a:string>

</Names></s:Body></s:Envelope>

Which code segment should you use?

 

A.            [MessageContract(IsWrapped = false)]public class CustomerNames{

[MessageBodyMember]public string[] Names;}

B.            [MessageContract(WrapperName = “”)]public class CustomerNames{

 [MessageBodyMember]public string[] Names;}

C.            [DataContract]public class CustomerNames{

 [DataMember]public string[] Names;}

D.            [DataContract] public class CustomerNames

{

 [DataMember(IsRequired = false)]

public string[] Names;

}

 

Correct Answer: A

Explanation/Reference:

If the message contract is not wrapped, that is, if the property IsWrapped is set to false, the message contract can have only one body part.

The name of the wrapper element for the request message contract must match the operation name. Use the WrapperName property of the message contract for this.

Using Message Contracts

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

 

 

QUESTION 102

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

Explanation/Reference:

 

 

QUESTION 103

clip_image002

A.            <scopes>

<add scope=”http://contoso.com/Chicago/*”/>

</scopes>

B.            <scopes>

<add scope=”http://contoso.com/Chicago”/>

</scopes>

C.            <scopes>

<add scope=”ldap:///ou=Building,ou=Chicago,o=contoso,c=us”/>

</scopes>

D.            <scopes>

<add scope=”ldap:///ou=*,o=contoso,c=us”/>

</scopes>

 

Correct Answer: B

Explanation

Explanation/Reference:

Configuring Discovery in a Configuration File

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

 

 

QUESTION 104

Your company has an existing Windows Communication Foundation (WCF) service that allows business partners to place orders.

The service uses netMsmqBinding. You find that processing every order in its own transaction is causing a delay.

You need to ensure that the service is configured to process multiple orders in one transaction. What should you do?

 

A. Use <serviceThrottling> service behavior and set the maxConcurrentCalls attribute.

B. Use <transactedBatching> endpoint behavior and set the maxBatchSize attribute.

C. Use <dispatcherSynchronizationBehavior> endpoint behavior and set the maxPendingReceives attribute.

D. Use <synchronousReceive> endpoint behavior.

 

Correct Answer: B

Explanation/Reference:<transactedBatching>

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

<transactedBatching>      A transport that is configured with transaction batching attempts to batch several receive operations into one transaction.                                         By doing so, the relatively high cost of creating a transaction and committing it in every receive operation is avoided.

<serviceThrottling> Specifies the throttling mechanism of a Windows Communication Foundation (WCF) service.                                        Throttling controls place limits on the number of concurrent calls, instances, or sessions to prevent over-consumption of resources.                                        A trace is written every time the value of attributes is reached. The first trace is written as a warning.

 

 

QUESTION 105

You are developing a Windows Communication Foundation (WCF) service that contains the following code segment.

[ServiceContract]public interface ICustomerService{

… }public class CustomerService : ICustomerService{

… }

The service is self-hosted in a console application. Older client applications access the service at http://contoso.com:8080/CustomerService/V1.

Newer client applications access the service at http://contoso.com:8080/CustomerService/V2.

You need to ensure that any client application can access the service at either address. Which code segment should you use?

 

A.            Uri serviceAddress1 = new Uri(“http://contoso.com:8080/CustomerService/V1”);Uri serviceAddress2 = new Uri(“http://contoso.com:8080/CustomerService/V2”);ServiceHost host = new ServiceHost(typeof(ICustomerService), new Uri[]{ serviceAddress1, serviceAddress2 });

B.            Uri serviceAddress1 = new Uri(“http://contoso.com:8080/CustomerService/V1”);Uri serviceAddress2 = new Uri(“http://contoso.com:8080/CustomerService/V2”);ServiceHost host = new ServiceHost(typeof(CustomerService), new Uri[]{ serviceAddress1, serviceAddress2 });

C.            Uri serviceAddress = new Uri(“http://contoso.com:8080/”);ServiceHost host = new ServiceHost(typeof(CustomerService), new Uri[]{ serviceAddress });host.AddServiceEndpoint(typeof(ICustomerService), new BasicHttpBinding(), “CustomerService/V1”);host.AddServiceEndpoint(typeof(ICustomerService), new BasicHttpBinding(), “CustomerService/V2”);

D.            Uri serviceAddress = new Uri(“http://contoso.com:8080/”);ServiceHost host = new ServiceHost(typeof(ICustomerService), new Uri[] { serviceAddress });host.AddServiceEndpoint(typeof(CustomerService), new BasicHttpBinding(), “CustomerService/V1”);host.AddServiceEndpoint(typeof(CustomerService), new BasicHttpBinding(), “CustomerService/V2”);

 

Correct Answer: C

Explanation/Reference:

ServiceHost() Initializes a new instance of the ServiceHost class.

ServiceHost(Object, Uri[]) Initializes a new instance of the ServiceHost class with the instance of the service and its base addresses specified.

ServiceHost(Type, Uri[]) Initializes a new instance of the ServiceHost class with the type of service and its base addresses specified.

ServiceHost Class

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

Data Contract Versioning

(http://msdn.microsoft.com/en-us/library/ms731138%28v=VS.100%29.aspx)

Best Practices: Data Contract Versioning

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

ServiceHost.AddServiceEndpoint (String, Binding, String) Adds a service endpoint to the hosted service with a specified contract, binding, and endpoint address. ServiceHost.AddServiceEndpoint (String, Binding, Uri) Adds a service endpoint to the hosted service with a specified contract, binding, and a URI that contains the endpoint address.

ServiceHost.AddServiceEndpoint (Type, Binding, String) Adds a service endpoint to the hosted service with a specified contract, binding, and endpoint address.

ServiceHost.AddServiceEndpoint (Type, Binding, Uri) Adds a service endpoint to the hosted service with a specified contract, binding, and URI that contains the endpoint address.

ServiceHost.AddServiceEndpoint (String, Binding, String, Uri) Adds a service endpoint to the hosted service with a specified contract, binding, endpoint address and URI that contains address at which it listens.

ServiceHost.AddServiceEndpoint (String, Binding, Uri, Uri) Adds a service endpoint to the hosted service with a specified contract, binding, and URIs that contain the endpoint and listening addresses.

ServiceHost.AddServiceEndpoint (Type, Binding, String, Uri) Adds a service endpoint to the hosted service with a specified contract, binding, an endpoint address, and a URI on which the service listens.

ServiceHost.AddServiceEndpoint (Type, Binding, Uri, Uri) Adds a service endpoint to the hosted service with a specified contract, binding, a URI that contains the endpoint address, and a URI on which the service listens

 

 

QUESTION 106

You need to modify a client application that consumes a Windows Communication Foundation (WCF) service.

The service metadata is no longer available. You need to modify the previously generated proxy to include asynchronous calls to the service.

What should you do?

 

A. Update the service reference with the Generate asynchronous operations option.

B. Create a partial class for the previously generated proxy and include the new asynchronous methods.

C. Create a class with the same name as the previously generated proxy and add the new asynchronous methods. Add the new class to a namespace that is different from the original proxy.

D. Create a class with the same name as the previously generated proxy and add the new asynchronous methods as partial methods. Add the new class to a namespace that is different from the original proxy.

 

Correct Answer: B

Explanation/Reference:

 

 

QUESTION 107

You are developing a Windows Communication Foundation (WCF) service that returns location information for authorized law enforcement agencies. The service contract is as follows:

[ServiceContract]public interface IMappingService{

[OperationContract]

long[] GetLocationCoordinates(String cityName);

[OperationContract]

long[] GetLocationOfCitizen(String ssn);

}

Users are authenticated and impersonated. The system uses ASP.NET roles.

The members of law enforcement are members of the LawEnforcement role.

You need to ensure that only members of the LawEnforcement role can call these methods.

What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

 

A. Add a PrincipalPermissionAttribute to each method that should be available only to members of law enforcement. Set its SecurityAction to Demand and set the role equal to LawEnforcement.

B. Use the CurrentPrincipal property of the thread. Call the IsInRole method specifying LawEnforcement as a parameter.

C. Create a GenericPrincipal specifying Thread.CurrentPrincipal.Identity as the IIdentityParameter and LawEnforcement as the only value for the Roles parameter.

D. At the beginning of each method, enumerate each ClaimSet in a new WindowsClaimSet. Use the FindClaims method to locate a claim type named Role with a right named LawEnforcement.

 

Correct Answer: AB

Explanation/Reference:Thread.CurrentPrincipal Property

Gets or sets the thread’s current principal (for role-based security).

Thread.CurrentPrincipal Property

(http://msdn.microsoft.com/en-us/library/system.threading.thread.currentprincipal.aspx)

To demand user membership:

Open the Windows Communication Foundation (WCF) code file that contains the implemented service contract code.

Apply the PrincipalPermissionAttribute attribute to each method that must be restricted to a specific group.

Set the Action property to Demand and the Role property to the name of the group.

For example:

// Only members of the CalculatorClients group can call this method.

[PrincipalPermission(SecurityAction.Demand, Role = “CalculatorClients”)]

public double Add(double a, double b)

{

 return a + b;}

How to: Restrict Access with the PrincipalPermissionAttribute Class

(http://msdn.microsoft.com/en-us/library/ms731200(v=vs.90).aspx)

 

 

QUESTION 108

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

You must record all available information for the first 1,000 messages processed, even if they are malformed.

You need to configure the message logging section of the configuration file. Which configuration segment should you use?

 

A.            <messageLogging logEntireMessage=”true”logMalformedMessages=”true”logMessagesAtServiceLevel=”true”logMessagesAtTransportLevel=”true”maxMessagesToLog=”1000″/>

B.            <messageLogging logMessagesAtServiceLevel=”true”logMessagesAtTransportLevel=”true”maxMessagesToLog=”1000″/>

C.            <messageLogging logEntireMessage=”false”logMessagesAtServiceLevel=”true”logMessagesAtTransportLevel=”false”maxMessagesToLog=”1000″/>

D. <messageLogging logMalformedMessages=”true”

 logMessagesAtServiceLevel=”true”

logMessagesAtTransportLevel=”false”

maxMessagesToLog=”1000″/>

 

Correct Answer: A

Explanation/Reference:Configuring Message Logging

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

MessageLoggingElement properties:

LogEntireMessage Gets or sets a value that specifies whether the entire message (message header and body) is logged.

logMalformedMessages

LogMessagesAtServiceLevel     Gets or sets a value that specifies whether messages are traced at the service level (before encryption and transport-related transforms).

LogMessagesAtTransportLevel Gets or sets a value that specifies whether messages are traced at the transport level.

 

 

QUESTION 109

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

The service configuration file has a <System.Diagnostics> element defined.

You need to ensure that all security audit information, trace logging, and message logging failures are recorded.

Which configuration segment should you add to the <System.Diagnostics> element?

 

A.            <sources> <source name=”System.ServiceModel” switchValue=”Information, ActivityTracing” propagateActivity=”true”><listeners> <add name=”xml” />

</listeners>

</source>

<source name=”System.ServiceModel.MessageLogging” propagateActivity=”true”>

<listeners>

<add name=”text” />

</listeners>

</source>

</sources>

B.            <sources> <source name=”System.ServiceModel” switchValue=”Information, ActivityTracing” propagateActivity=”true” /><source name=”System.ServiceModel.MessageLogging” propagateActivity=”true” />

</sources>

C.            <sources> <source name=”System.ServiceModel” switchValue=”Information, ActivityTracing” propagateActivity=”true”><listeners> <add name=”xml” />

</listeners>

</source>

<source name=”System.ServiceModel.MessageLogging” propagateActivity=”true”>

<listeners>

 <add name=”xml” />

</listeners>

</source>

</sources>

<sharedListeners>

<add name=”xml” type=”System.Diagnostics.XmlWriterTraceListener” initializeData=”& ” />

</sharedListeners>

D.            <sources> <source name=”System.ServiceModel” switchValue=”Information, ActivityTracing” propagateActivity=”true” /><source name=”System.ServiceModel.MessageLogging” propagateActivity=”true” />

</sources>

<sharedListeners>

<add name=”xml” type=”System.Diagnostics.XmlWriterTraceListener” initializeData=”& ” />

</sharedListeners>

 

Correct Answer: C

Explanation/Reference:

 

 

QUESTION 110

You are modifying a Windows Communication Foundation (WCF) service that allows customers to update financial data.

The service currently requires a transaction from the client application and is working correctly.

The service contract is defined as follows. (Line numbers are included for reference only.)

01 [ServiceContract()]

02 public interface IDataUpdate

03 {

04 [OperationContract()]

05 [TransactionFlow(TransactionFlowOption.Mandatory)]

06 void Update(string accountNumber, double amount);

07

08 }

09

10 public class UpdateService : IDataUpdate

11 {

12

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

14 public void Update(string accountNumber, double amount)

16 {

17 try

18 {

19 …

20 }

19 catch(Exception ex)

20 {

21 …

22 }

23 }

24 }

The service must be modified so that client applications do not need to initiate a transaction when calling the operation. The service must use the client application’s transaction if one is available. Otherwise it must use its own transaction. You need to ensure that the service operation is always executed within a transaction. What should you do?

 

A. Replace line 05 with the following code.

[TransactionFlow(TransactionFlowOption.NotAllowed)]

B. Replace line 13 with the following code.

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

C. Replace line 05 with the following code.

[TransactionFlow(TransactionFlowOption.Allowed)]

D. Replace line 13 with the following code.

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

 

Correct Answer: C

Explanation/Reference:

 

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