Ensurepass

QUESTION 161

You are developing a Windows Communication Foundation (WCF) service. The service needs to access out-of-process resources. You need to ensure that the service accesses these resources on behalf of the originating caller. What should you do?

 

A.

Set the value of ServiceSecurityContext.Current.WindowsIdentity.ImpersonationLevel to TokenImpersonationLevel.Impersonation.

B.

Set the value of ServiceSecurityContext.Current.WindowsIdentity.ImpersonationLevel to TokenImpersonationLevel.Delegation.

C.

Set the PrincipalPermissionAttribute on the service contract and update the binding attribute in the endpoint element of the configuration file to wsHttpBinding.

D.

Set the PrincipalPermissionAttribute on the service contract and update the bindingConfiguration attribute in the endpoint element of the configuration file to wsHttpBinding.

 

Correct Answer: B

 

 

QUESTION 162

You are using tracing to diagnose run-time issues when you look at the traces for the service in Svc Trace viewer exe, you see what is shown in the exhibit (Click the Exhibit button)

 

clip_image001

 

The exception trace is selected in Svc Trace reviewer exe.

 

You need to interpret the trace results to determine where the error occurred and what to do next.

 

What should you do?

 

A.

This issue occurred in the ServiceHost during ServiceHost Open.

Enable WMI by adding the following configuration to the system.serviceModel configuration section in the application configuration file

<diagnostics wmiProviderEnabledetrue’!>

Restart the application and inspect the endpoints visible through WMI

B.

This issue occurred in the Service Host during Service Host. Open. Compare the security settings for any endpoints that use an MSMQ transport to the security configuration of the MSMQ queue used by the endpoint

C.

This issue occurred at the Service Host when receiving a message Compare the security configurations on the client and server to make sure that they are compatible.

D.

This issue occurred at the ServiceHost when accepting an initial set of messages from MSMQ.Log all messages sent between the clients and sever.

 

Correct Answer: B

 

 

 

 

 

 

 

QUESTION 163

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

 

<ServiceContract()>

 

Public Interface ICustomerService

 

 

End Interface

 

Public Class CustomerService

 

Implements ICustomerService

 

 

End Class

 

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.

Dim serviceAddress1 As Uri =

New Uri(“http://contoso.com:8080/CustomerService/V1”)

Dim serviceAddress2 As Uri =

New Uri(“http://contoso.com:8080/CustomerService/V2”)

Dim host As ServiceHost =

New Service Host(GetType(ICustomerService),

New Uri() {serviceAddress1, serviceAddress2})

B.

Dim serviceAddress1 As Uri =

New Uri(“http://contoso.com:8080/CustomerService/V1”)

Dim serviceAddress2 As Uri =

New Uri(“http://contoso.com:8080/CustomerService/V2”)

Dim host As ServiceHost =

New ServiceHost(GetType(CustomerService),

New Uri() {serviceAddress1, serviceAddress2})

C.

Dim serviceAddress As Uri =

New Uri(“http://contoso.com:8080/”)

Dim host As ServiceHost =

New Servic eHost(GetType(CustomerService),

New Uri() {serviceAddress})

host.AddServiceEndpoint(GetType(ICustomer Service),

New BasicHttpBinding(), “CustomerService/V1”)

host.AddServiceEndp oint(GetType(ICustomerService),

New BasicHttpBinding(), “CustomerService/V2”)

D.

Dim serviceAddress As Uri =

New Uri(“http://contoso.com:8080/”)

Dim host As ServiceHost =

New Service Host(GetType(ICustomerService),

New Uri() {serviceAddress})

host.AddServiceEndpoint(GetType(CustomerService),

New BasicHttpBinding(), “CustomerService/V1”)

host.AddServiceEnd point(GetType(CustomerService),

New BasicHttpBinding(), “CustomerService/V2”)

 

Correct Answer: D

 

 

QUESTION 164

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 ASP.NET Forms Authentication model.

 

You add a service file named Authentication.svc that contains the following code segment:

 

<%@ ServiceHost

 

Service=”System.Web.ApplicationServices.AuthenticationService”

 

Factory=”System.Web.ApplicationServices.ApplicationServicesHostFactory” %>

 

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.Web.ApplicationServices.AuthenticationService.

D.

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

 

Correct Answer: AC

 

 

QUESTION 165

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

 

 

QUESTION 166

You develop a Windows Communication Foundation (WCF) SOAP service that contains a class named Order. The Order class includes a field named secret that stores private data.

 

The Order class includes the following code:

 

clip_image002

 

The service has the following requirements:

 

clip_image004The secret field must be encrypted.

clip_image004[1]All other fields in the Order class must serialize as plain text.

 

You need to configure serialization for the Order class.

 

What should you do?

 

A.

Add a MessageHeader attribute to the secret field and set the ProtectionLevel to Sign.

Add a MessageBodyMember attribute to each of the other fields of the class.

B.

Add a MessageBodyMember attribute to the secret field and set the ProtectionLevel to Sign.

Add a MessageBodyMember attribute to each of the other fields of the class.

C.

Add a MessageBodyMember attribute to the secret field and set the ProtectionLevel to EncryptAndSign.

Add a MessageBodyMember attribute to each of the other fields of the class.

D.

Add a MessageHeader attribute to the secret field and set the ProtectionLevel to EncryptAndSign.

Add a MessageBodyMember attribute to each of the other fields of the class.

 

Correct Answer: D

 

 

 

 

 

 

 

 

 

 

QUESTION 167

You are consuming a Windows Communication Foundation (WCF) service. The service interface is defined as follows:

 

[DataContract(Namespace = “”)]

 

public class Item

 

{

 

 

}

 

[ServiceContract(Namespace = “”)]

 

public interface ICatalog

 

{

 

[OperationContract]

 

[WebInvoke(Method = “POST”, UriTemplate = “/Item”)]

 

Item UpdateItem(Item item);

 

}

 

The client application receives a WebResponse named response with the response from the service.

 

You need to deserialize this response into a strongly typed object representing the return value of the method.

 

Which code segment should you use?

 

A.

DataContractSerializer s = new DataContractSerializer(typeof(Item));

Item item = s.ReadObject(response.GetResponseStream()) as Item;

BinaryFormatter f = new BinaryFormatter();

B.

Item item = f.Deserialize(response.GetResponseStream()) as Item;

XmlDictionaryReader r = JsonReaderWriterFactory.CreateJsonReader( response.GetResponseStream(),

XmlDictionaryReaderQuotas.Max);

C.

DataContractSerializer s = new DataContractSerializer(typeof(Item));

Item item = s.ReadObject(r) as Item;

D.

DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(Item));

Item item = s.ReadObject(response.GetResponseStream()) as Item;

 

Correct Answer: A

 

 

 

 

 

 

QUESTION 168

You are creating a Windows Communication Foundation (WCF) service. The service endpoints change frequently. On the service, you add a new ServiceDiscoveryBehavior to the Behaviors collection of the ServiceHost Description property. You need to ensure that client applications can communicate with the service and discover changes to the service endpoints. What should you do?

 

A.

Add a new ServiceDiscoveryBehavior to the Behaviors collection in the client application.

B.

Add a new AnnouncementClient to the Behaviors collection in the client application.

C.

Use the FindCriteria class and the UdpDiscoveryEndpoint class to set up the binding in the client application.

D.

Use the DiscoveryProxy class and the EndpointDiscoveryMetadata class to set up the binding in the client application.

 

Correct Answer: C

 

 

QUESTION 169

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.

 

clip_image006

 

Which code segment should you use?

 

A.

[MessageContract(IsWrapped = false)]

public class CustomerNames

{

[MessageBodyMember]

public string[] Names;

}

B.

[MessageContract(WrapperName = “”)]

public class CustomerNames

{

C.

[MessageBodyMember]

public string[] Names;

}

D.

[DataContract]

public class CustomerNames

{

[DataMember]

public string[] Names;

}

E.

[DataContract]

public class CustomerNames

{

F.

[DataMember(IsRequired = false)]

public string[] Names;

}

 

Correct Answer: A

 

 

QUESTION 170

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

 

01 <ServiceContract()>

 

02 <ServiceBehavior(

 

03 InstanceContextMode:=InstanceContextMode.Single)>

 

04 Public Class CalculatorService

 

05

 

06 <OperationContract()>

 

07 Public Function Calculate(ByVal op1 As Double,

 

08 ByVal op As String, ByVal op2 As Double) As Double

 

&

 

24 End Function

 

25

 

26 End Class

 

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

 

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

Try Microsoft 70-513 Free Demo