Ensurepass

QUESTION 201

You develop a Windows Communication Foundation (WCF) service that employees use to access bonus information. You define the following service contract. (Line numbers are included for reference only.)

 

01 [ServiceContract(SessionMode = SessionMode.Required)]

 

02 public interface IFinancialService

 

03 {

 

04 [OperationContract]

 

05 string Login(int employeeID, string passwordHash);

 

06

 

07 [OperationContract]

 

08 double GetBonus(int month);

 

09

 

10 [OperationContract(IsTerminating = true)]

 

11 void Logout();

 

12 }

 

Client applications can invoke methods without logging in.

 

You need to ensure that the client applications invoke Login before invoking any other method.

 

You also need to ensure that client applications cannot consume the service after invoking Logout.

 

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

 

A.

Replace line 04 with the following code.

[OperationContract(IsInitiating = false)]

B.

Replace line 04 with the following code.

[OperationContract(IsInitiating = true, IsTerminating = true)]

C.

Replace line 07 with the following code.

[OperationContract(IsInitiating = false)]

D.

Replace line 10 with the following code.

[OperationContract(IsInitiating = false,

IsTerminating = true)]

 

Correct Answer: CD

 

 

QUESTION 202

DRAG DROP

You have a client application that consumes a Windows Communication Foundation (WCF) service. The service contains a class named RegistrationService. The RegistrationService class contains two methods named SubmitRegistration and GetRegistrations.

 

The service has the following requirements:

 

clip_image002The client application must call the SubmitRegistration method synchronously.

clip_image002[1]The client application must call the GetRegistrations method asynchronously.

 

You need to complete the client-side code to call the WCF service.

 

Which six code segments should you use in sequence? (To answer, move the appropriate six code segments from the list of code segments to the answer area and arrange them in the correct order.)

 

clip_image004

 

Correct Answer:

clip_image006

QUESTION 203

A Windows Communication Foundation (WCF) application exposes a service as a SOAP endpoint for consumption by cross-platform clients. During integration testing, you find that one of the clients is not generating the correct messages to the WCF application. In order to debug the issue and fix the communication, you need to configure the service to log messages received from the client. What should you do?

 

A.

Set an etwTracking behavior on the service and configure a listener for the System.ServiceModel trace source.

B.

Set an etwTracking behavior on the service and configure a listener for the System.ServiceModel.MessageLuqqing trace source.

C.

Enable messageLogging in the System.ServiceModel diagnostics element configuration and configure a listener for the System.ServiceModel.MessageLogging trace source.

D.

Enable messageLogging in the System.ServiceModel diagnostics element configuration and configure a listener for the System.ServiceModel trace source.

 

Correct Answer: C

 

 

QUESTION 204

You are developing a client that sends several types of SOAP messages to a Windows Communication

 

Foundation (WCF) service method named PostData PostData is currently defined as follows:

 

<OperationContract>

 

Sub PostData(Byval data As Order) You need to modify PostData so that it can receive any SOAP message.

 

Which code segment should you use?

 

A.

<OperationContract(lsOneWay True, Action ReplyAction `-)>

Sub PostData(ByVal data As Order)

B.

OperationContract(lsOneway: zTrue, Action:z’-‘, ReplyAction: z”-‘)>

Sub PostData(ByVal data As BodyWriter)

C.

<OperationContract> Sub PostData(Byval data As BodyWriter)

D.

<OperationContract0> Sub PostData(ByVal data As Message)

 

Correct Answer: A

 

 

QUESTION 205

You are creating a Windows Communication Foundation (WCF) service based on WSHttpBinding. New audit requirements dictate that callers must be authenticated on every call to ensure that their credentials have not been revoked. You need to ensure that the service will not cache the security request token. What should you do?

 

A.

Apply a ServiceBehavior attribute to the service implementation class with the InstanceContextMode property set to Single.

B.

In the message security configuration, change clientCredentialType from IssuedToken to UserName.

C.

In the message security configuration, set establishSecurityContext to false.

D.

At the end of every operation, call the SessionStateUtility.RaiseSessionEnd method.

 

Correct Answer: C

 

 

QUESTION 206

You create a service and deploy it on a network in a building named Building1. You will deploy the service to Building2.

 

The service in Building1 is configured using the following discovery scopes.

 

clip_image008

 

The service in Building2 will be configured using the following discovery scopes.

 

clip_image010

 

You need to ensure that the client application can discover the service in Building1 or the service in Building2.

 

Which scopes should you add to the client configuration file?

 

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

 

 

 

 

 

QUESTION 207

You develop a Windows Communication Foundation (WCF) service to generate reports. Client applications call the service to initiate report generation but do not wait for the reports to be generated. The service does not provide any status to the client applications.

 

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

 

clip_image011

 

You need to ensure that client applications can initiate reports without waiting for status.

 

Which two actions should you perform (Each correct answer presents part of the solution. Choose two.)

 

A.

Insert the following code at line 04.

[OperationContract(IsOneWay=true)]

B.

Insert the following code at line 04.

[OperationContract(AsyncPattern=false)]

C.

At line 05, change the GenerateReports method from private to public.

D.

Remove line 08. At line 05, change the return type of GenerateReports method to void.

 

Correct Answer: AD

 

 

QUESTION 208

Four Windows Communication Foundation (WCF) services are hosted in Microsoft Internet Information Services (IIS). No behavior configuration exists in the web.config file. You need to configure the application so that every service and endpoint limits the number of concurrent calls to 50 and the number of concurrent sessions to 25. Which XML segment should you add to the system.serviceModel configuration section of the web.config file?

 

A.

<behaviors>

<serviceBehaviors>

<behavior name=”*”>

<serviceThrottling maxConcurrentCalls=”50″ maxConcurrentSessions=”25″/>

</behavior>

</serviceBehaviors>

</behaviors>

B.

<behaviors>

<serviceBehaviors>

<behavior name=”default”>

<serviceThrottling maxConcurrentCalls=”50″ maxConcurrentSessions=”25″/>

</behavior>

</serviceBehaviors>

</behaviors>

C.

<behaviors>

<serviceBehaviors>

<behavior name=””>

<serviceThrottling maxConcurrentCalls=”50″ maxConcurrentSessions=”25″/>

</behavior>

</serviceBehaviors>

</behaviors>

D.

<behaviors>

<serviceBehaviors>

<behavior name=”ALL”>

<serviceThrottling maxConcurrentCalls=”50″ maxConcurrentSessions=”25″/>

</behavior>

</serviceBehaviors>

</behaviors>

 

Correct Answer: C

 

 

QUESTION 209

A Windows Communication Foundation (WCF) solution exposes the following service over a TCP binding. (Line numbers are included for reference only.)

 

clip_image012

 

MessageDatabase supports a limited number of concurrent executions of its methods.

 

You need to change the service to allow up to the maximum number of executions of the methods of MessageDatabase. This should be implemented without preventing customers from connecting to the service.

 

What should you do?

 

A.

Change the service behavior as follows.

<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Multiple,

InstanceContextMode:=InstanceContextMode.Single)>

B.

Change the service behavior as follows.

<ServiceBehavior(ConcurrencyMode:=ConcurrencyMode.Single,

InstanceContextMode:=InstanceContextMode.PerSession)>

C.

Add a throttling behavior to the service, and configure the maxConcurrentCalls.

D.

Add a throttling behavior to the service, and configure the maxConcurrentSessions.

 

Correct Answer: C

 

 

QUESTION 210

You are developing a Windows Communication Foundation (WCF) service to provide an in- memory cache. The following code is part of your solution. (Line numbers are included for reference only.)

 

01

 

02 Public Interface IlnMemoryCacheService

 

03

 

04 <OperationContract()>

 

05 Function GetCachedItem(

 

ByVal key As String) As String

 

06

 

07 <OperationContract() >

 

08 Sub CacheItem(

 

ByVal key As String,

 

ByVal item As String)

 

09

 

10 End Interface

 

11

 

12 <ServiceBehavior(

 

InstanceContextMode:=InstanceContextHode.Single)>

 

13 Public Class CacheService

 

14 Implements IlnHemoryCacheService

 

15

 

16 Dim cache As Hashtatale – New Hashtable)>

 

17

 

18 Public Function GetCachedItem(

 

ByVal key As String) As String

 

mplements IInHemoryCacheService.GetCachedltem

 

19

 

20 Return cache (key) .ToStrlng()

 

21

 

22 End Function

 

23

 

24 Public Sub Cacheltem(

 

ByVal key As String,

 

ByVal item As String)

 

Implements ilnMemoryCacheService.Cacheltem

 

Then

 

25

 

26 If (cache.Contains(key)

 

27 cache.Remove(key)

 

28 End If

 

29

 

30 cache.Add(key, item)

 

31

 

32 End Sub

 

33

 

34 End Class

 

Users report that the cache is getting updated with cache changes of other users. You need to ensure that each user’s cache is maintained and isolated from other users.

 

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

 

A.

Insert the following code at line 01.

<ServiceContract(SessionMode:=SessionHode.NotAllowed)>

B.

At line 12, replace InstanceContextHode.Single with InstanceContextHode.PerSession.

C.

At line 12, replace InstanceContextHode.Single with InstanceContextHode.PerCall.

D.

Insert the following code at line 01.

<ServiceContract(SessionHode:=SessionHode.Required)>

 

Correct Answer: BD

 

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

Try Microsoft 70-513 Free Demo