Latest MCTS 70-513 Dumps Real Exam Download 121-130

Ensurepass

QUESTION 121

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

The client applications call the service in a transaction. The service contract is defined as follows.

(Line numbers are included for reference only.)

01 02 03 04 05 06 07 08  [ServiceContract]public interface IDataUpdate{ [OperationContract][TransactionFlow(TransactionFlowOption.Mandatory)]void Update(string accountNumber, double amount);} 

09   

10 11 12 13 14 15 16 17  class UpdateService : IDataUpdate{ [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]public void Update(string accountNumber, double amount){ try{ … 

18 19 20 21 22  }catch(Exception ex){ WriteErrorLog(ex); … 

23 24 25 26  }}} 

Customers report that the transaction completes successfully even if the Update method throws an exception. You need to ensure that the transaction is aborted if the Update method is not successful. What should you do?

 

A. Insert the following line at line 22:

throw;

B. Insert the following line at line 09:

[ServiceBehavior(TransactionAutoCompleteOnSessionClose=false)]

C. Replace line 12 with the following line:

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

D. Insert the following line at line 09.:

[ServiceBehavior(TransactionAutoCompleteOnSessionClose=true)]

 

Correct Answer: A

Explanation/Reference:

It is needed to throw Exception. Otherwise, it is handled successfully in Catch block.

 

 

QUESTION 122

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.

var service = new WarehouseService();var host = 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.Multiple)]

B. [CallbackBehavior(ConcurrencyMode=ConcurrencyMode.Multiple)]

C. [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Single)]

D. [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Reentrant)]

 

Correct Answer: B

Explanation/Reference:PerSession A new InstanceContext object is created for each session. PerCall A new InstanceContext object is created prior to and recycled subsequent to each call.

If the channel does not create a session this value behaves as if it were PerCall. Single Only one InstanceContext object is used for all incoming calls and is not recycled subsequent to the calls. If a service object does not exist, one is created.

InstanceContextMode Enumeration

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

ConcurrencyMode Enumeration

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

“If the InstanceContextMode value is set to Single the result is that your service can only process one message at a time unless you also set the ConcurrencyMode value to Multiple.”

So single is fine to use for InstanceContextMode

 

 

QUESTION 123

You create a Windows Communication Foundation (WCF) service. 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?

 

clip_image002

 

Correct Answer: A

Explanation/Reference:Tracing WMI Activity

(http://msdn.microsoft.com/en-us/library/windows/desktop/aa826686(v=vs.85).aspx)

Using Windows Management Instrumentation for Diagnostics

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

Security

By default, the WCF WMI provider grants “execute method”, “provider write”, and “enable account” permission for Administrator,

and “enable account” permission for ASP.NET, Local Service and Network Service. In particular, on non-Windows Vista platforms,

the ASP.NET account has read access to the WMI ServiceModel namespace. If you do not want to grant these privileges to

a particular user group, you should either deactivate the WMI provider (it is disabled by default), or disable access for the specific user group.

In addition, when you attempt to enable WMI through configuration, WMI may not be enabled due to insufficient user privilege.

However, no event is written to the event log to record this failure.

To modify user privilege levels, use the following steps:

1.

Click Start and then Run and type compmgmt.msc.

2.

Right-click Services and Application/WMI Controls to select Properties.

3.

Select the Security Tab, and navigate to the Root/ServiceModel namespace. Click the Security button.

4.

Select the specific group or user that you want to control access and use the Allow or Deny checkbox to configure permissions.

 

 

QUESTION 124

You are creating a Windows Communication Foundation (WCF) service that uses claims-based authorization. The following code retrieves the correct claim set.

var claims = ServiceSecurityContext.Current.AuthorizationContext.ClaimSets[0];

You need to validate that the requesting client application has included a valid DNS value in the claim. Which code segment should you use to retrieve the claim for validation?

 

A.            claims.FindClaims(ClaimTypes.Dns, Rights.PossessProperty).FirstOrDefault();

B.            claims.FindClaims(ClaimTypes.Dns, Rights.Identity).FirstOrDefault();

C.            claims.ContainsClaim(Claim.CreateDnsClaim(ClaimTypes.Dns));

D.            claims.Equals(ClaimTypes.Dns);

 

Correct Answer: A

Explanation/Reference:ClaimSet.FindClaims Method

When overridden in a derived class, searches for a Claim object that matches the specified claim type and rights in the ClaimSet.

Identity Gets a string that specifies that the right represents an identity. PossessProperty Gets a string that specifies that the right represents a property that the entity associated with a claim possesses.

ClaimTypes class

(http://msdn.microsoft.com/en-us/library/system.identitymodel.claims.claimtypes.aspx)

Authorization In WCF-Based Services

(http://msdn.microsoft.com/en-us/magazine/cc948343.aspx)

Rights Class

(http://msdn.microsoft.com/en-us/library/system.identitymodel.claims.rights.aspx)

 

 

QUESTION 125

You are creating an application that consumes a Windows Communication Foundation (WCF) service.

The service implements the IService contract. The client application contains the CallbackHandler class, which implements IServiceCallback.

You need to ensure that a client proxy is created that can communicate with the service over a duplex channel.

Which code segment should you use?

 

A.            var handler = new CallbackHandler();var clientFactory = new DuplexChannelFactory<IService>(new WSHttpContextBinding());var client = clientFactory.CreateChannel(new InstanceContext(handler), new EndpointAddress(“…”));

B.            var handler = new CallbackHandler();var clientFactory = new DuplexChannelFactory<IService>(typeof(CallbackHandler), new WSDualHttpBinding());var client = clientFactory.CreateChannel(new InstanceContext(handler), new EndpointAddress(“…”));

C.            var handler = new CallbackHandler();var clientFactory = new DuplexChannelFactory<IService>(new WSHttpBinding());var client = clientFactory.CreateChannel(new InstanceContext(handler), new EndpointAddress (“…”));

D.            var handler = new CallbackHandler();var clientFactory = new DuplexChannelFactory<IService>(typeof(CallbackHandler), new WSDualHttpBinding());var client = clientFactory.CreateChannel(new EndpointAddress(“…”));

 

Correct Answer: B

Explanation/Reference:DuplexChannelFactory<TChannel> Class

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

 

 

QUESTION 126

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

[MessageContract(WrapperNamespace=”http://www.movies.com”, ProtectionLevel=ProtectionLevel.None)]public class Ticket{

 [MessageBodyMember(Namespace=”http://www.movietheater.com”, Order=1)]

public DateTime ShowTime = DateTime.Now;

 [MessageBodyMember(Namespace=”http://www.movietheater.com”)]

public string ReservationName = “Smith”;

 [MessageBodyMember(Namespace=”http://www.movietheater.com”)]

public int NumberOfSeats = 0;

}

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.movietheater.com”>2010-07-05TOO:51:10.0999304-05:00</ShowTime><NumberOfSeats xmlns=”http://www.movietheater.com”>0</NumbecOfSeats><ReservationName xmlns=”http://www.movietheater.com” />

</Ticket>

D.            <Ticket xmlns=”http://www.movietheater.com”><ShowTime xmlns=”http://www.movietheater.com”>2010-07-05TOO:51:10.0999304-05:00</ShowTime><NumberOfSeats xmlns=”http://wwv.movietheater.com”>0</NumberOfSeats><ReservationName xmlns=”http://www.movietheater.com” />

</Ticket>

 

Correct Answer: A

Explanation/Reference:Using Message Contracts

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

MessageBodyMemberAttribute.Order Property

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

Order of SOAP Body Parts

In some circumstances, you may need to control the order of the body parts. The order of the body elements is alphabetical by default,

but can be controlled by the System.ServiceModel.MessageBodyMemberAttribute.Order property. This property has the same semantics

as the System.Runtime.Serialization.DataMemberAttribute.Order property, except for the behavior in inheritance scenarios

(in message contracts, base type body members are not sorted before the derived type body members).

EXAMPLE:

In the following example, amount would normally come first because it is first alphabetically. However, the Order property puts it into the third position.

[MessageContract]public class BankingTransaction{

 [MessageHeader] public Operation operation;

[MessageBodyMember(Order=1)] public Account sourceAccount;

[MessageBodyMember(Order=2)] public Account targetAccount;

[MessageBodyMember(Order=3)] public int amount;

}

Data Member Order

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

Example: [DataContract] public class BaseType {

 [DataMember]

 public string zebra; } [DataContract] public class DerivedType : BaseType {

 [DataMember(Order = 0)]

 public string bird;

 [DataMember(Order = 1)]

 public string parrot;

 [DataMember]

 public string dog;

 [DataMember(Order = 3)]

 public string antelope;

 [DataMember]

 public string cat;

 [DataMember(Order = 1)]

 public string albatross;

} Output <DerivedType>

 <!– Zebra is a base data member, and appears first. –>

 <zebra/>

<!– Cat has no Order, appears alphabetically first. –>

 <cat/>

 <!– Dog has no Order, appears alphabetically last. –>

 <dog/>

<!– Bird is the member with the smallest Order value –>

 <bird/>

 <!– Albatross has the next Order value, alphabetically first. –>

 <albatross/>

 <!– Parrot, with the next Order value, alphabetically last. –>

 <parrot/>

 <!– Antelope is the member with the highest Order value. Note that Order=2 is skipped –> <antelope/> </DerivedType>

 

 

QUESTION 127

You are debugging a Windows Communication Foundation (WCF) service. The service uses signed and encrypted messages. You need to configure logging so that you can read the contents of the messages. What should you do?

 

A. Set maxSizeMessagesToLog to 10

B. Set logMessageAtServiceLevel to true.

C. Set maxMessagesToLog to 10.

D. Set logMessageAtTransportLevel to true.

 

Correct Answer: B

Explanation/Reference:Configuring Message Logging

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

Service Level

Messages logged at this layer are about to enter (on receiving) or leave (on sending) user code.

If filters have been defined, only messages that match the filters are logged.

Otherwise, all messages at the service level are logged. Infrastructure messages (transactions, peer channel, and security)

are also logged at this level, except for Reliable Messaging messages. On streamed messages, only the headers are logged.

In addition, secure messages are logged decrypted at this level.

Transport Level

Messages logged at this layer are ready to be encoded or decoded for or after transportation on the wire.

If filters have been defined, only messages that match the filters are logged. Otherwise, all messages at the transport layer are logged.

All infrastructure messages are logged at this layer, including reliable messaging messages. On streamed messages,

only the headers are logged. In addition, secure messages are logged as encrypted at this level, except if a secure transport such as HTTPS is used.

 

 

QUESTION 128

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 saleId);

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

<behavior> <serviceDebug includeExceptionDetailInFaults=”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/Reference:

Set IncludeExceptionDetailInFaults to true to enable exception information to flow to clients for debugging purposes.

This property requires a binding that supports either request-response or duplex messaging.

In all managed applications, processing errors are represented by Exception objects.

In SOAP-based applications such as applications, methods that implement service operations communicate

error information using SOAP fault messages. Because applications execute under both types of error systems,

any managed exception information that needs to be sent to the client must be converted from exceptions into SOAP faults.

For more information, see Specifying and Handling Faults in Contracts and Services.

During development, you may want your service to also send other exceptions back to the client to assist you in debugging.

This is a development-only feature and should not be employed in deployed services.

To facilitate debugging development, set the IncludeExceptionDetailInFaults to true either in code or using an application configuration file.

When enabled, the service automatically returns safer exception information to the caller.

These faults appear to the client as FaultException<TDetail> objects of type ExceptionDetail.

 Important

Setting IncludeExceptionDetailInFaultsto true enables clients to obtain information about internal service method exceptions;

it is only recommended as a way of temporarily debugging a service application. In addition, the WSDL for a method that returns

unhandled managed exceptions in this way does not contain the contract for the FaultException<TDetail> of type ExceptionDetail.

Clients must expect the possibility of an unknown SOAP fault to obtain the debugging information properly.

 

 

QUESTION 129

You are developing an application that performs file backups in the background. The background application

will host a Windows Communication Foundation (WCF) service and must be active as soon as the machine is running.

The background application will not have a user interface. A front-end application will consume the WCF service and will provide the user interface.

You need to choose a host environment for the WCF service. Which hosting environment should you choose?

 

A. Microsoft Internet Information Services (IIS) 6.0

B. Windows Process Activation Services (WAS)

C. A Windows Forms application

D. A Windows Service

 

Correct Answer: D

Explanation/Reference:Hosting Services

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

Hosting Options:

1.

Self-Hosting in a Managed Application (self-hosted)

2.

Managed Windows Services

3.

Internet Information Services (IIS)

4.

Windows Process Activation Service (WAS)

 

 

QUESTION 130

You are developing a Windows Communication Foundation (WCF) service. Client applications require reliable sessions to access the service.

Users report that they receive ServerTooBusyException errors when their client application tries to establish a session.

You need to ensure that the service can handle a minimum of 30 client connection requests.

Which ReliableSessionBindingElement property should you configure?

 

A. MaxRetryCount

B. MaxTransferWindowSize

C. MaxPendingChannels

D. InactivityTimeout

 

Correct Answer: C

Explanation/Reference:ReliableSessionBindingElement Class

Represents the binding element that can produce the sending and receiving channels required for a reliable session between endpoints.

MaxPendingChannels property

Channels are pending when they are waiting to be accepted. Once that limit is reached,

no channels are created and put in pending mode until this number goes down (by accepting pending channels).

This is a limit for each listener.

When the threshold is reached and a remote application tries to establish a new reliable session,

the request is denied and the open operation that prompted this faults.

MaxPendingChannels Gets or sets the largest number of channels that can be pending during the reliable session.

MaxRetryCount                   Gets or sets the maximum number of times that a message attempts to be transferred during the reliable session.

MaxTransferWindowSize Gets or sets the largest number of messages that can exist in either the send buffer or the receive buffer.

InactivityTimeout Gets or sets an interval of time that a service remains inactive before closing.

ReliableSessionBindingElement Class

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

 

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