Ensurepass

QUESTION 221

You are configuring a routing service to call a target service. The routing service has no knowledge of the target service’s data tyes other than the service contract. The operation contract for all of the methods of the target service specifies IsOneWay=true. You need to specify the endpoint information for the routing service. What should you do?

 

A.

In the target service configuration file, specify “*” for the client endpoint contract and “*” for the service endpoint contract.

B.

In the routing service configuration file, specify “*” for the client endpoint contract and System.ServiceModel.Routing.ISimplexDatagramRouter for the service endpoint contract.

C.

In the routing service configuration file, specify “*” for the client endpoint contract and “*” for the service endpoint contract.

D.

In the routing service configuration file, specify “*” for the client endpoint contract and System.ServiceModel.Routing.IRequestReplyRouter for the service endpoint contract.

 

Correct Answer: B

 

 

QUESTION 222

You develop a Windows Communication Foundation (WCF) service that includes the following code. (Line numbers are included for reference only.)

 

clip_image002

 

ServiceB must not accept reentrant service calls.

 

You need to modify the behavior of the service.

 

What should you do?

 

A.

Insert the following code segment at line 07:

<ServiceBehavior(ReleaseServiceOnTransactionTransactionComplete:=True)>

B.

Replace the code segment at line 01 with the following code segment:

<ServiceBehavior (InstanceContextMode:=InstanceContextMode.Single) >

C.

Insert the following code segment at line 07:

<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple)>

D.

Insert the following code segment at line 07:

<ServiceBehavior(ReleaseServiceInstanceOnTransactionComplete:=False)>

 

Correct Answer: A

Explanation:

* InstanceContextMode.Single

/ 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.

Note:

For singleton lifetime behavior (for example, if the host application calls the ServiceHost constructor and passes an object to use as the service), the service class must set InstanceContextMode to InstanceContextMode.Single, or an exception is thrown when the service host is opened.

 

 

QUESTION 223

A Windows Communication Foundation (WCF) service is deployed with netTcpBinding. This service uses a duplex message exchange pattern. You are developing the next version of the WCF service. You discover that your company’s hardware load balancer performs correctly only for WCF services that use HTTP. You need to ensure that your service works with the load balancer. What should you do?

 

A.

Use basicHttpBinding.

B.

Create a custom binding that has the compositeDuplex, textMessageEncoding, and namedPipeTransport binding elements in this order.

C.

Create a custom binding that has the compositeDuplex, textMessageEncoding, and wsHttpTransport binding elements in this order.

D.

Use wsHttpBinding.

 

Correct Answer: C

 

 

QUESTION 224

You are developing an application to update a users 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.xml?status={text}”)]

 

void UpdateStatus(string text);

 

}

 

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

 

A.

using (WebChannelFactory<ISocialStatus> factory =

new WebChannelFactory<ISocialStatus>(“SocialClient”))

{

factory.Credentials.UserName.UserName = user.Name;

factory.Credentials.UserName.Password = user.Password;

ISocialStatus socialChannel = factory.CreateChannel();

socialChannel.UpdateStatus(newStatus);

}

B.

using (ChannelFactory<ISocialStatus> factory =

new WebChannelFactory<ISocialStatus>(typeof(ISocialStatus)))

{

factory.Credentials.UserName.UserName = user.Name;

factory.Credentials.UserName.Password = user.Password;

ISocialStatus socialChannel = factory.CreateChannel();

socialChannel.UpdateStatus(newStatus);

}

C.

using (ChannelFactory<ISocialStatus> factory =

new ChannelFactory<ISocialStatus>(“POST”))

{

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

factory.Credentials.Windows.ClientCredential.SecurePassword.

SetAt(0, Convert.ToChar(user.Password) );

ISocialStatus socialChannel = factory.CreateChannel();

socialChannel.UpdateStatus(newStatus);

}

D.

using (WebChannelFactory<ISocialStatus> factory =

new WebChannelFactory<ISocialStatus>(typeof(ISocialClient)))

{

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

factory.Credentials.Windows.ClientCredential.SecurePassword.

SetAt(0, Convert.ToChar(user.Password) );

ISocialStatus socialChannel = factory.CreateChannel();

socialChannel.UpdateStatus(newStatus);

}

 

Correct Answer: A

 

 

QUESTION 225

You are hosting a Windows Communication Foundation (WCF) service under Microsoft Internet Information Services (IIS) 7.0.

 

You have set up a Web site in IIS Manager. The physical path is C:\wwwroot\Calendar. There is a Calendar.svc file in the C:\wwwroot\Calendar folder. It contains the following directive.

 

<%@ ServiceHost Language=”VB” Debug=”true” Service=”Calendar.Calendar” CodeBehind=”Calendar.svc.vb” %>

 

The Calendar.svc.vb file contains the source for the Calendar class in the Calendar namespace. You compile this code into the Calendar.dll file.

 

You need to deploy your service to the Web site.

 

What should you do?

 

A.

Copy the Calendar.dll file to the C:\wwwroot\Calendar\code folder.

B.

Copy the Calendar.dll file to the C:\wwwroot\Calendar\bin folder.

C.

Copy the Calendar.svc.vb file to the C:\wwwroot\Calendar\bin folder.

D.

Copy the Calendar.svc.vb file to the C:\wwwroot\Calendar\code folder.

 

Correct Answer: B

 

 

QUESTION 226

A Windows Communication Foundation (WCF) client application is consuming an RSS syndication feed from a blog. You have a SyndicationFeed variable named feed. The application iterates through the items as follows. (Line numbers are included for reference only.)

 

01 For Each item As SyndicationItem In feed.Items

 

02

 

03

 

04 Next

 

You need to display the content type and body of every syndication item to the console.

 

Which two lines of code should you insert between lines 02 and 03?

 

A.

Console.WriteLine(item.Content.Type)

Console.WriteLine(DirectCast(item.Content,

TextSyndicationContent).Text)

B.

Console.WriteLine(item.Content.GetType())

Console.WriteLine(DirectCast(item.Content,

TextSyndicationContent).Text)

C.

Console.WriteLine(item.Content.Type)

Console.WriteLine(item.Content.ToString())

D.

Console.WriteLine(item.Content.GetType())

Console.WriteLine(item.Content.ToString())

 

Correct Answer: A

 

 

QUESTION 227

You are developing a Windows Communication Foundation (WCF) service that is used to check the status of orders placed by customers. The following code segment is part of your service. (Line numbers are included for reference only.)

 

clip_image003

 

You need to ensure that the service always listens at net.pipe://SupplyChainServer/Pipe.

 

What should you do?

 

clip_image004

 

A.

Option A

B.

Option B

C.

Option C

D.

Option D

 

Correct Answer: C

 

 

QUESTION 228

You are modifying an existing Windows Communication Foundation (WCF) service that is defined as follows.

 

clip_image005

 

SubmitOrder makes a call to another service. The ProcessMessage method does not perform as expected under a heavy load.

 

You need to enable processing of multiple messages. New messages must only be processed when the ProcessMessage method is not processing requests, or when it is waiting for calls to SubmitOrder to return.

 

Which attribute should you apply to the MessageProcessor class?

 

A.

CallbackBehavior ( ConcurrencyMode = ConcurrencyMode.Reentrant )

B.

CallbackBehavior ( ConcurrencyMode = ConcurrencyMode.Multiple )

C.

ServiceBehavior ( ConcurrencyMode = ConcurrencyMode.Reentrant )

D.

ServiceBehavior ( ConcurrencyMode = ConcurrencyMode.Multiple )

 

Correct Answer: C

 

 

QUESTION 229

A WCF service code is implemented as follows. (Line numbers are included for reference only.)

 

01 [ServiceContract]

 

02 [ServiceBehavior(InstanceContextMode =

 

03 InstanceConcextMode.Single)]

 

04 public class CalculatorService

 

05 {

 

06 [OperacionContract]

 

07 public double Calculate(double opl, string op, double op2)

 

08 {

 

 

24 }

 

25 }

 

You need to decrease the response time of the service.

 

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

 

A.

Change the service behavior to the following:

[ServiceBehavior(

InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple) ]

B.

Change the service behavior to the following:

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall) ]

C.

Require the clients use threads, the Parallel Task Library, or other mechanism to issue service calls in parallel.

D.

Require the clients to use async operations when calling the service.

 

Correct Answer: AB

 

 

QUESTION 230

You are developing a client application that uses the following code to consume a Windows Communication Foundation (WCF) service. (Line numbers are included for reference only.)

 

01 BasicHttpBinding myBinding = new BasicHttpBinding();

 

02 EndpointAddress myEndpointAddress =

 

new EndpointAddress(

 

“http://contoso.com/TaxService.svc”);

 

03

 

04 ITaxService client = channelFactory.CreateChannel();

 

05 string data = client.GetData(1);

 

You need to consume the service.

 

Which code segment should you insert at line 03?

 

A.

var channelFactory = new ChannelFactory<ITaxService>();

B.

var channelFactory = new ChannelFactory<ITaxService>( myBinding);

C.

var channelFactory = new ChannelFactory<ITaxService>( myBinding, myEndpointAddress);

D.

var channelFactory = new ChannelFactory<ITaxService>( “http://contoso.com/TaxService.svc”);

 

Correct Answer: C

 

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

Try Microsoft 70-513 Free Demo