Ensurepass

QUESTION 71

A Windows Communication Foundation (WCF) service is self-hosted in a console application. The service implements the IDataAccess contract, which is defined in the MyApplication namespace.

 

The service is implemented in a class named DataAccessService, which implements the IDataAccess interface and also is defined in the MyApplication namespace.

 

The hosting code is as follows. (Line numbers are included for reference only.)

 

clip_image001

 

You need to create a ServiceHost instance and assign it to the host variable. You also need to instantiate the service host.

 

Which line of code should you insert at line 04?

 

A.

host = New ServiceHost(“MyApplication.DataAccessService”)

B.

host = New ServiceHost(“MyApplication.IDataAccess”)

C.

host = New ServiceHost(GetType(IDataAccess))

D.

host = New ServiceHost(GetType(DataAccessService))

 

Correct Answer: D

 

 

QUESTION 72

You create a Windows Communication Foundation (WCF) service.

 

The service must meet the following requirements:

 

clip_image003Communicate errors as exceptions that originate in the service operations.

clip_image003[1]Publish the errors as part of the WCF contract.

 

You need to throw an exception inside the service operation method.

 

Which type of exception should you throw?

 

A.

ProtocolException

B.

FaultException

C.

PoisionMessageException

D.

CommunicationException

 

Correct Answer: B

 

 

QUESTION 73

You develop a Windows Communication Foundation (WCF) RESTful service that provides media streaming services. The service includes the following code. (Line numbers are included for reference only.)

 

clip_image004

 

The service must return an XML response.

 

You need to apply the correct attribute to AddMediaTitle method.

 

Which code segment should you insert at line 05?

 

A.

[WebInvolce(ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped)]

B.

[WebInvoice (ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle .Bare) ]

C.

[WebInvolce (Method= “POST”) ]

D.

[WebInvoice]

 

Correct Answer: A

QUESTION 74

A self-hosted Windows Communication Foundation (WCF) service uses a secure HTTP binding with a custom principal permission mode. The binding requires users to provide their Windows logon credentials. You need to retrieve the identity of the caller. What are two possible properties you can use to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

 

A.

Thread.CurrentPrincipal.Identity-Name

B.

HttpContext.Current.User.Identity.Name

C.

ServiceSecurity Context.Current.Primary Identity.Name

D.

OperationContext.Current.ServiceSecurity Context.Primary Identity.Name

 

Correct Answer: CD

 

 

QUESTION 75

You are adding a Windows Communication Foundation (WCF) service to an existing application. The application is configured as follows. (Line numbers are included for reference only.)

 

01 <configuration>

 

02 <system.serviceModel>

 

03 <services>

 

04 <service name=”Contoso.Sales.StockService”

 

05

 

behaviorConfiguration=”MetadataBehavior”>

 

06 <host>

 

07 <baseAddresses>

 

08 <add

 

baseAddress=”http://contoso.com:8080/StockService” />

 

09 </baseAddresses>

 

10 </host>

 

11 </service>

 

12 </serv
ices>

 

13 <behaviors>

 

14 <serviceBehaviors>

 

15 <behavior name=”MetadataBehavior”>

 

16 </behavior>

 

17 </serviceBehaviors>

 

18 </behaviors>

 

You need to configure the service to publish the service metadata.

 

Which two actions should you perform?

 

(Each correct answer presents part of the solution. Choose two.)

 

A.

Add the following XML segment between lines 10 and 11.

<endpoint address=””

binding=”mexHttpBinding”

contract=”IMetadataExchange” />

B.

Add the following XML segment between lines 10 and 11.

<endpoint address=””

binding=”basicHttpBinding”

contract=”IMetadataExchange” />

C.

Add the following XML segment between lines15 and 16.

<serviceDiscovery>

<announcementEndpoints>

<endpoint address=””/>

</announcementEndpoints>

</serviceDiscovery>

D.

Add the following XML segment between lines 15 and 16.

<serviceMetadata httpGetEnabled=”true”/>

 

Correct Answer: AD

 

 

QUESTION 76

A Windows Communication Foundation (WCF) service is generating a separate namespace declaration for each body member of a message contract, even though all body members share the same namespace. You need to simplify the XML representation of your message contract so that the namespace is only declared once. What should you do?

 

A.

Declare a wrapper namespace for the message contract by using the WrapperNamespace property of the MessageContract attribute

B.

Explicitly set the Namespace property of all the MessageBodyMember attributes to the same namespace.

C.

Declare all the body members as properties of a DataContract class and use the class as the only body member of the message contract.

D.

Declare all of the body members as properties of a separate MessageContract class and use the class as the only body member of the message contract.

 

Correct Answer: C

 

 

 

 

 

 

 

 

 

QUESTION 77

A Windows Communication Foundation (WCF) service interacts with the database of a workflow engine. Data access authorization is managed by the database, which raises security exceptions if a user is unauthorized to access it. You need to ensure that the application transmits the exceptions raised by the database to the client that is calling the service. Which behavior should you configure and apply to the service?

 

A.

routing

B.

serviceDebug

C.

serviceSecurityAudit

D.

workflowUnhandledException

 

Correct Answer: B

 

 

QUESTION 78

You are implementing a Windows Communication Foundation (WCF) client application that consumes the ICatalog and lCatalog2 service interfaces. You need to ensure that the client discovers services implementing these interfaces. The services may already be online or may come online within a 30 second time limit. How should you use WCF Discovery to accomplish this?

 

A.

Create one FindCriteria object for each interface and set the Duration of each FindCriteria to 30 seconds Call the FindAsync method of the DiscoveryClient class twice, one time for each of the FindCriteria objects, to search for the services.

B.

Create one FindCriteria object for each interface and set the Duration of each FindCriteria to two seconds.

Create a loop that calls the Find method of the DiscoveryClient class to search for the services.

Within each loop iteration, call the Find method of the DiscoveryClient class once for each of the FindCriteria objects Run the loop until a service is found or 30 seconds pass.

C.

Create a single FindCriteria object and add both interfaces to its ContractTypeNames collection. Set the criteria’s Duratio
n to two seconds.

Create a loop that calls the Find method of the DiscoveryClient class to search for the services.

Within each loop iteration, call the Find method of the DiscoveryClient class to search for the services Run the loop until a service is found or 30 seconds pass.

D.

Create a single FindCritera object and add both interfaces to the ContractTypeNames collection. Set the Duration to 30 seconds and use the FindAsync method of the DiscoveryClient class to search for the services.

 

Correct Answer: B

 

 

QUESTION 79

A Windows Communication Foundation (WCF) service uses a list of application-defined roles for operations. These roles are stored in a database. You need to authorize calls against the list of roles retrieved from the database. Which service behavior should you use to authorize the calls?

 

A.

<serviceAuthorization principalPermissionModez”None” roleProviderNames”SqlProvider” />

B.

<serviceAuthorization principalPermissionMode=”None” roleProviderNamee”SqlProvider” Is

C.

<serviceAuthorization principalPermissionModes”None” roleProviderNames”SqlProvider” I>

D.

<serviceAuthorization principalPermissionModez”None” roleProviderNamez’SqlProvider” />

 

Correct Answer: B

 

QUESTION 80

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

 

Instant Access to Download Testing Software & PDF File for Microsoft 70-513 Real Exam

Instant Access to Try Microsoft 70-513 Free Demo

Comments are closed.