Ensurepass

QUESTION 181

HOTSPOT

You are developing a Windows Communication Foundation (WCF) service. You implement a data contract to pass complex data to and from the service.

 

The service includes the following code:

 

clip_image001

 

You need to verify the order in which the data is serialized.

 

For each of the following statements, select True if the statement is true. Otherwise, select False.

 

clip_image002

 

Correct Answer:

clip_image003

 

 

 

 

 

 

 

 

 

 

QUESTION 182

You develop a Windows Communication Foundation (WCF) service that interacts with Microsoft Message Queuing (MSMQ). The service requires sessions. You need to create a custom binding that enables messages sent to the queue to be viewed when you are using a listener tool. Which binding elements should you use?

 

A.

textMessageEncoding and msmqTransport in this order

B.

textMessageEncoding and msmqIntegrationTransport in this order

C.

msmqTransport and textMessageEncoding in this order

D.

msmqIntegrationTransport and textMessageEncoding in this order

 

Correct Answer: A

 

 

QUESTION 183

You are creating a Windows Communication Foundation (WCF) service that is implemented as follows.

 

(Line numbers are included for reference only.)

 

01 [ServiceContract]

 

02 [ServiceBehavior (includeExceptionDet¨¤ilslnFaults = true) 1

 

03 putiic class OrderService

 

04 {

 

05 [Operation Contract]

 

06 putiic void Submit Order (Order an Order)

 

07 {

 

O8 try

 

09 {

 

10 …

 

11 )

 

12 catch (DivideByZeroExcepton ex)

 

13 {

 

14

 

15 )

 

16 )

 

17 )

 

You need to ensure that the stack trace details of the exception are not included in the error information sent to the client.

 

What should you do?

 

A.

Replace line 14 with the following line.

Throw:

B.

Replace line 14 with the following line

Throw new FaultException<Order>(anOrder, ex.ToString(fl;

C.

After hne 05, add the following line.

[FaultContract(typeof(FaukEception<Order>))J

Replace line 14 with the following line throw ex;

D.

Alter hne 05, add the following line

[FaultContract(typeof(FaultException<Order>))J

Replace line 14 with the following line.

Throw new FaultException<Order>(anOrder, “Divide by zero exception”):

 

Correct Answer: D

 

 

QUESTION 184

A Windows Communication Foundation (WCF) service handles online order processing for your company. You discover that many requests are being made with invalid account numbers. You create a class named AccountNumberValidator that has a method named Validate. Before the message is processed, you need to validate account numbers with AccountNumberValidator and reject messages with invalid account numbers. You create a new class that implements the IParameterInspector interface. Which code segment should you use in this class?

 

A.

Public Sub AfterCall(

ByVal operationName As String,

ByVal outputs() As Object,

ByVal returnValue As Object,

ByVal correlationState As Object) _ Implements

IParameterInspector.AfterCall

Dim accountNumber As String = GetAccountNumber(outputs)

Dim validator As

AccountNumberValidator = New AccountNumberValidator()

If (Not validator.Validate(accountNumber)) Then

Throw New FaultException()

End If

End Sub

Public Function BeforeCall(

ByVal operationName As String,

ByVal inputs() As Object) As Object _

Implements IParameterInspector.BeforeCall

Return Nothing

End Function

B.

Public Sub AfterCall(

ByVal operationName As String,

ByVal outputs() As Object,

ByVal returnValue As Object,

ByVal correlationState As

Object) _

Implements IParameterInspector.AfterCall

Return

End Sub

Public Function BeforeCall(

ByVal operationName As String,

ByVal inputs() As Object) As Object _

Implements IParameterInspector.BeforeCall

Dim accountNumber As String = GetAccountNumber(inputs)

Dim validator As AccountNumberValidator = New AccountNumberValidator()

If (Not validator.Validate(accountNumber)) Then

Throw New FaultException()

End If

Return Nothing

End Function

C.

Public Sub AfterCall(

ByVal operationName As String,

ByVal outputs() As Object,

ByVal returnValue As Object,

ByVal correlationState As Object) _

Implements IParameterInspector.AfterCall

Dim accountNumber As String = GetAccountNumber(outputs)

Dim validator As AccountNumberValidator =

New AccountNumberValidator()

If (Not validator.Validate(accountNumber)) Then

returnValue = New FaultException()

End If

End Sub

Public Function BeforeCall(

ByVal operationName As String,

ByVal inputs() As Object) As Object _

Implements

IParameterInspector.BeforeCall

Return Nothing

End Function

D.

Public Sub AfterCall(

ByVal operationName As String,

ByVal outputs() As Object,

ByVal returnValue As Object,

ByVal correlationState As Object) _

Implements IParameterInspector.AfterCall

Return

End Sub

Public Function BeforeCall(

ByVal operationName As String,

ByVal inputs() As Object) As Object _

Implements IParameterInspector.BeforeCall

Dim accountNumber As String = GetAccountNumber(inputs)

Dim validator As AccountNumberValidator =

New AccountNumberValidator()

If (Not validator.Validate(accountNumber)) Then

Return New FaultException()

End If

End Function

 

Correct Answer: C

 

 

 

QUESTION 185

You develop an ASP.NET web application that is hosted in the virtual directory named SecureApp. The web application uses the ASP.NET membership provider. The application pool for the website uses the dedicated domain account named MyDomain\WebServiceAccount. The web.config file contains the connectionStrings element. You need to secure the connectionStrings element for the web application. Which of the following two commands must you run at a command prompt? (Each correct answer presents part of the solution. Choose two.)

 

A.

aspnet_regiis -pe “connectionStrings” -app “MyDomain\WebServiceAccount”

B.

aspnet_regiis -pe “connectionStrings” -app “/SecureApp”

C.

aspnet_regsql -pa “NetFrameworkConfigurationKey” “MyDomain\WebServiceAccount”

D.

aspnet_regiis -pa “NetFrameworkConfigurationKey” “MyDomain\WebServiceAccount”

 

Correct Answer: BD

Explanation:

B (not A):

* aspnet_regiis -pe section

Encrypts the specified configuration section. This argument takes the following optional modifiers:

 prov provider Specifies the encryption provider to use. app virtualPath Specifies that encryption should occur at the level of the included path. location subPath Specifies the subdirectory to encrypt. pkm Specifies that the Machine.config file should be encrypted instead of the Web.config file

 

D:

* Before ASP.NET can decrypt encrypted information in the Web.config file, the identity of your ASP.NET application must have read access to the encryption key that is used to encrypt and decrypt the encrypted sections.

The RSA key container that is used by the default RsaProtectedConfigurationProvider provider is named “NetFrameworkConfigurationKey”.

 

* aspnet_regiis -pa container account

Grants permission for the specified user or group account to access the specified key container. This argument takes the following optional modifiers:

 pku Substitutes a user-specified container for the default machine container. csp provider Specifies the container provider to use. full Specifies that full access should be added, rather than the default read-only access.

 

Incorrect:

Not C: The ASP.NET SQL Server Registration tool is used to create a Microsoft SQL Server database for use by the SQL Server providers in ASP.NET, or to add or remove options from an existing database.

 

 

QUESTION 186

A client application calls a Windows Communication Foundation (WCF) service with a proxy class that was generated by Visual Studio. The service binding was changed from wsHttpBinding to basicHttpBinding. The method signatures in the service contract are changed. After these changes, the client application receives errors when calling methods on the service. You need to ensure that the client can invoke methods on the service successfully. What should you do?

 

A.

Update the configuration file to use basicHttpBinding.

B.

Enable anonymous authentication for the service.

C.

Copy the configuration file elements under the <system.servicelviodel> element from the service back to the client.

D.

Update the service reference.

 

Correct Answer: D

 

 

QUESTION 187

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

 

01 <ServiceContract0>

 

02 PuElic Interface ITeamMessageService

 

03

 

04 <OperationContractO>

 

05 Function GetMessage() As String

 

06

 

07 <OperationContract0>

 

08 Sub PutMessage(Byval message As String)

 

09 End Interface

 

The code for the serAce class is as follows:

 

10 Public Class TeamMessageService0

 

11 Implements lTearmt4essageService

 

12

 

13 Dim key As Guid = Guid.NewGuid()

 

14 Dim message As String = “Today’s Message’

 

15

 

16 PuUic Function GetMessage0As String –

 

17 lmpements lTearm*AessageServiceGetMessage

 

18

 

19 Retun String. Fommat(“Message:{0) Key:{ 1}”, message, key)

 

20 End Function

 

21

 

22 PubIic Sub PutMessage(ByV message As Stnng) –

 

23 lmpements lTearrlessageService PutMessage

 

24

 

25 Me message = message

 

26 End Sub

 

27

 

28 End Class

 

The service is self-hosted The hosting code rs as follows:

 

29 Dim host As ServiceHost =

 

New ServiceHost(GetType(TearrwiessageSeMce))?

 

30 Dim binding As Basic HttpBindngt

 

New BasicHttpBindiig(BasicHttpSecurityMode. None)

 

31 host.AddServiceEndpoint(

 

“MyAppication lTearrtAessageService”, binding

 

Thttp /Ilac aihost. 1 2345)

 

32host Open()

 

You need to ensure that all clients calling GetMessage will retrieve the same string, even if the message is upd(ed by clients calling PutMessage what should you do?

 

A.

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

<ServceBehavior(lnstanceContextMode lnstanceContextMode. Single)>

B.

Add the following attribute to the TeamMessageService class, before line 1 0002E

<ServiceBehavior( lnstanceContextll ode. = InstanceContextMode. PerSession)>

C.

Pass a service instance to the instancing code in line 29, as follows. Dim host As ServiceHost z New ServiceHost(New TeamMessageServiceO)

D.

Redefine the message string in line 14, as follows:

Shared message As String “Today’s Message”

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

Public Sub PutMessage(ByVal message As rng) – Implements ITean- MessageService.PutMessage

TeamMessageSenAce.message = message End Sub

 

Correct Answer: A

 

 

 

 

 

 

 

 

 

 

QUESTION 188

You are developing a Windows Communication Foundation (WCF) service. You enable message logging, trace listeners, activity propagation, and tracing on the trace sources.

 

You have the following code segment in the client application. (Line numbers are included for reference only.)

 

clip_image004

 

You encounter errors when your client application consumes the service.

 

You need to ensure that your client application can correlate tracing information with the service.

 

Which code segment should you add at line 04?

 

clip_image006

 

A.

Option A

B.

Option B

C.

Option C

D.

Option D

 

Correct Answer: C

 

 

 

 

 

 

 

 

QUESTION 189

DRAG DROP

You use Visual Studio to develop a Windows Communication Foundation (WCF) service. The service is not hosted. You cannot use the WcfTestClient.exe tool to test the service. You need to test the service from a separate Visual Studio solution that contains a simple console application. Which four actions should you perform in sequence? (To answer, move the appropriate four actions from the list of actions to the answer area and arrange them in the correct order.)

 

clip_image008

 

Correct Answer:

clip_image010

 

 

 

 

 

QUESTION 190

You are developing a Windows Communication Foundation (WCF) REST service to provide access to a library book catalog. The following code segment defines the service contract. (Line numbers are included for reference only.)

 

clip_image011

 

Library patrons want the ability to search the catalog by title.

 

You need to ensure that the GetBookByTitle method is exposed as a service method.

 

Which code segment should you insert at line 05?

 

A.

[WebGet(UriTemplate = “Book/{title}”)]

B.

[WebGet(UriTemplate = “BookByTitle/{title}”)]

C.

[WebGet(UriTemplate = “{titleToSearch}”]

D.

[WebGet(UriTemplate = “Book/{titleToSearch}”)]

 

Correct Answer: B

 

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

Try Microsoft 70-513 Free Demo