Ensurepass

QUESTION 141

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: A

Explanation:

Only ConcurrencyMode.Multiple gives as singleton service with support of multiple requests.

 

 

QUESTION 142

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

 

 

QUESTION 143

You are developing an application to update a user s social status. You need to consume the service using Windows Communication Foundation (WCF).

 

The client configuration is as follows:

 

<system.serviceModel>

 

<bindings>

 

<webHttpBinding>

 

<binding name=”SocialConfig”>

 

<security mode=”TransportCredentialOnly”>

 

<transport clientCredentialType=”Basic”

 

realm=”Social API” />

 

</security>

 

</binding>

 

</webHttpBinding>

 

</bindings>

 

<client>

 

<endpoint address= ” http:// contoso .com “

 

binding=”webHttpBinding”

 

bindingConfiguration=”SocialConfig”

 

contract=”ISocialStatus”

 

name=”SocialClient” />

 

</client>

 

</system.serviceModel>

 

The service contract is defined as follows:

 

<ServiceContract()>

 

Public Interface ISocialStatus

 

<OperationContract()>

 

<WebInvoke(UriTemplate:=”/statuses/update.xmlstatus={text}”)>

 

Sub UpdateStatus(ByVal text As String)

 

End Interface

 

Which code segment should you use to update the social status?

 

A.

Using factory As WebChannelFactory(Of ISocialStatus) =

New WebChannelFactory(Of ISocialStatus)(“SocialClient”)

factory.Credentials.UserName.UserName = user.Name

factory.Credentials.UserName.Password = user.Password

Dim socialChannel As ISocialStatus = factory.CreateChannel()

socialChannel.UpdateStatus(newStatus)

End Using

B.

Using factory As ChannelFactory(Of ISocialStatus) =

New WebChannelFactory(Of ISocialStatus)(GetType(ISocialStatus))

factory.Credentials.UserName.UserName = user.Name

factory.Credentials.UserName.Password = user.Password

Dim socialChannel As ISocialStatus = factory.CreateChannel()

socialChannel.UpdateStatus(newStatus)

End Using

C.

Using factory As ChannelFactory(Of ISocialStatus) =

New ChannelFactory(Of ISocialStatus)(“POST”)

factory.Credentials.Windows.ClientCredential.UserName = user.Name

factory.Credentials.Windows.ClientCredential.SecurePassword.SetAt( 0, user.Password)

Dim socialChannel As ISocialStatus = factory.CreateChannel()

socialChannel.UpdateStatus(newStatus)

End Using

D.

Using factory As WebChannelFactory(Of ISocialStatus) =

New WebChannelFactory(Of ISocialStatus)(GetType(ISocialClient))

factory.Credentials.Windows.ClientCredential.UserName = user.Name

factory.Credentials.Windows.ClientCredential.SecurePassword.SetAt( 0, user.Password)

Dim socialChannel As ISocialStatus = factory.CreateChannel()

socialChannel.UpdateStatus(newStatus)

End Using

 

Correct Answer: B

 

 

QUESTION 144

Your Windows Communication Foundation (WCF) client application uses HTTP to communicate with the service. You need to enable message logging and include all security information such as tokens and nonces in logged messages. What should you do?

 

A.

In the application configuration file, add the logKnownPii attribute to the message logging diagnostics source and set the value of the attribute to true.

Generate the ContosoService class using the Add Service Reference wizard. Add a reference to System.ServiceModel.Routing.dll.

Add the following code segment:

ContosoService client = new ContosoService();

SoapProcessingBehavior behavior = new SoapProcessingBehavior();

behavior.ProcessMessages = true;

client.Endpoint.Behaviors.Add(behavior);

B.

In the application configuration file, add the following XML segment to the system.serviceModel configuration section group.

<diagnostics>

<messageLogging logMessagesAtTransportLevel=”true” logEntireMessage=”true” />

</diagnostics>

C.

In the machine configuration file, add the following XML segment to the system.serviceModel configuration section.

<machineSettings enableLoggingKnownPii=”true” />

Generate the ContosoService class using the Add Service Reference wizard.

Add the following code segment:

ContosoService client = new ContosoService();

client.Endpoint.Behaviors.Add(new CallbackDebugBehavior(true));

D.

In the machine configuration file, add the following XML segment to the system.serviceModel configuration section.

<machineSettings enableLoggingKnownPii=”true” />

In the application configuration file, add the logKnownPii attribute to the message logging diagnostics source and set the value of the attribute to true. In the application configuration file, add the following XML segment to the system.serviceModel configuration section group.

<diagnostics>

<messageLogging logMessagesAtTransportLevel=”true”/>

</diagnostics>

 

Correct Answer: D

 

 

QUESTION 145

You are creating an ASP NET web application that hosts several Windows Communication Foundation (WCF) services the services have ASP.NET Compatibility Mode enabled.

 

Users authenticate with the Web application by using a cookie-based ASR NET Forms Authentication model. You add a service tile named Authentication. svc that contains the following code segment:

 

<%@ SenviceHost Servicee”System

 

Web Application Services Authentication

Service”Factory=”System.Web.ApplicationServices.AppicationServicesHostFactory’ %>.

 

You need to ensure that users can access the WCF services without having to re-authenticate.

 

Which two configuration settings should you add? (Each is part of a complete solution. Choose two.)

 

A.

In the system web.extensions/scripting/webServices/authenticationService element, set the enabled attribute to true.

B.

In the system web.extensions/scripting/webServices/profileService element, set the enabled attribute to true.

C.

Add a service endpoint with basicHttpBinding for the contract System.WebApplicationServices.AuthenticationService.

D.

Add a custom service behavior named AuthenticationServiceTypeBehaviors with a serviceAuthenticationManager element that has serviceAuthenticationManagerType set to System Web Security. SQL Membership Provider

 

Correct Answer: AC

 

 

QUESTION 146

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

 

You have the following requirements:

 

clip_image002Messages must be sent over TCP.

clip_image002[1]The service must support transactions.

clip_image002[2]Messages must be encoded using a binary encoding.

clip_image002[3]Messages must be secured using Windows stream-based security.

 

You need to implement a custom binding for the service.

 

In which order should the binding stack be configured?

 

A.

tcpTransport

windowsStreamSecurity

transactionFlow

binaryMessageEncoding

B.

transactionFlow

binaryMessageEncoding

windowsStreamSecurity

tcpTransport

C.

windowsStreamSecurity

tcpTransport

binaryMessageEncoding t

ransactionFlow

D.

binaryMessageEncoding

transactionFlow

tcpTransport

windowsStreamSecurity

 

Correct Answer: B

 

 

QUESTION 147

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 4.0.0.0 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

 

 

QUESTION 148

You are developing a Windows Communication Foundation (WCF) service. One of the parameters used with the service operations is a security token. The security token is not sensitive. The monitoring software tracks security tokens and can read tokens in clear text only. The company security policy requires that you validate all clear text data passed over the corporate network. You need to ensure that the service verifies that the security token is not changed during transit. What should you do?

 

A.

Implement IEndpointldentityProvider in the message contract class.

B.

For all the security-sensitive members, set the ProtectionLevel parameter of the MessageBodyMember or MessageHeader attribute to EncryptAndSign.

C.

For all the security-sensitive members, set the ProtectionLevel parameter of the MessageBodyMember or MessageHeader attribute to Sign.

D.

Implement ISecureConversationSession in the message contract class.

 

Correct Answer: C

 

 

QUESTION 149

You are developing a data contract for a Windows Communication Foundation (WCF) service. The data in the data contract must participate in round trips. Strict schema validity is not required. You need to ensure that the contract is forward-compatible and allows new data members to be added to it. Which interface should you implement in the data contract class?

 

A.

ICommunicationObject

B.

IExtension(Of T)

C.

IExtensibleObject(Of T)

D.

IExtensibleDataObject

 

Correct Answer: D

 

 

QUESTION 150

A Windows Communication Foundation (WCF) solution uses the following contract to share a message across its clients. (Line numbers are included for reference only.)

 

clip_image003

 

The code for the service class is as follows.

 

clip_image004

 

The service is self-hosted. The hosting code is as follows.

 

clip_image005

 

You need to ensure that all clients calling GetMessage will retrieve the updated string if the message is updated by any client calling PutMessage.

 

What should you do?

 

A.

Add the following attribute to the TeamMessageService class, before line 10.

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]

B.

Add the following attribute to the TeamMessageService class, before line 10.

[ServiceBehavior(InstanceContextMode =

InstanceContextMode.PecSession) ]

Than change che binding definition on the service at line 25, and on the client to the following:

WSHttpBinding binding = new WSHttpBinding(SecurityMode.None);

binding.ReiiabieSession.Enabled = true;

C.

Pass a service instance to the instancing code in line 24, as follows:

ServiceHost host = new ServiceHost(new TeamMessageService());

D.

Redefine the message string in line 13, as follows:

static string message = “Today’ s Message”;

Then change the implementation of PutMessage in lines 19-22 to the following.

public void PutMessage(string message) {

TeamMessageService.message = message; >

 

Correct Answer: A

 

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

Try Microsoft 70-513 Free Demo