MS .Net Framework 70-513

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Akshansh
A
Akshansh
Community Contributor
Quizzes Created: 1 | Total Attempts: 156
| Attempts: 156 | Questions: 70
Please wait...
Question 1 / 70
0 %
0/100
Score 0/100
1. You are creating a Windows Communication Foundation (WCF) service that implements operations in a RESTful manner.   You need to add a delete operation. You implement the delete method as follows: void DeleteItems(string id); You need to configure WCF to call this method when the client calls the service with the HTTP DELETE operation.  What should you do?

Explanation

The correct answer is to add the WebInvoke(UriTemplate="/Items/{id}", Method="DELETE") attribute to the operation. This is because the WebInvoke attribute is used to specify the HTTP verb and URI template for a RESTful operation in WCF. In this case, the attribute is set to Method="DELETE" to indicate that the operation should be called when the client uses the HTTP DELETE method. The UriTemplate="/Items/{id}" specifies the URI template for the operation, where {id} is a placeholder for the ID parameter that will be passed in the URL.

Submit
Please wait...
About This Quiz
MS .Net Framework 70-513 - Quiz


70-513 - TS: Windows Communication Foundation Development via MS. NET Framework 4
Number of Questions Included: 145
Updated: 2012-05-28
This dump is the collection composed by Lyudmyla of all unique... see morequestions from dumps of BOB, FSAN and WASP, with Darths corrections. see less

2. A Windows Communication Foundation (WCF) service is responsible for transmitting XML documents between systems. The service has the following requirements: It must minimize the transmission size by attaching the XML document as is without using escape characters or base64 encoding. It must interoperate with systems that use SOAP but are not built on the .NET plafform. You need to configure the service to support these requirements. Which message encoding should you use?

Explanation

MTOM (Message Transmission Optimization Mechanism) message encoding should be used to configure the service to support the given requirements. MTOM encoding allows the service to attach the XML document as is without using escape characters or base64 encoding, thus minimizing the transmission size. Additionally, MTOM encoding is interoperable with systems that use SOAP but are not built on the .NET platform. This makes it the suitable choice for the given scenario.

Submit
3. You are creating a Windows Communication Foundation (WCF) service to process orders. The data contract for the order is defined as follows: [DataContract] public class Order {     [DataMember]     public string CardHolderName { get; set; }     [DataMember]     public string CreditCardNumber { get; set; } } You have the following requirements: Enable the transmission of the contents of Order from the clients to the service. Ensure that the contents of CreditCardNumber are not sent across the network in clear text. Ensure that the contents of CreditCardNumber are accessible by the service to process the order. You need to implement the service to meet these requirements. What should you do?

Explanation

not-available-via-ai

Submit
4. You are creating a Windows Communication Foundation (WCF) service. You have the following requirements: Messages must be sent over TCP The service must support transactions. Messages must be encoded using a binary encoding Messages must be secured using Windows stream-based security. You need to implement a custom binding for the service. In which order should the binding stack be configured?

Explanation

The correct order for configuring the binding stack is transactionFlow, binaryMessageEncoding, windowsStreamSecurity, and tcpTransport. This order ensures that transactions are supported, messages are encoded using a binary encoding, messages are secured using Windows stream-based security, and messages are sent over TCP.

Submit
5. Windows Communication Foundation (WCF) service will be hosted in Microsoft Internet Information Services (IIS). You create a new application in IIS to host this service and copy the service DLL to the bin directory of the application. You need to complete the deployment of this service to IIS. What should you do next?

Explanation

To complete the deployment of the WCF service to IIS, you need to create a .svc file and add a @ServiceHost directive to this file. This .svc file should be copied to the root of the application directory. The .svc file acts as the entry point for the WCF service in IIS, and the @ServiceHost directive specifies the service class that will be hosted. By copying the .svc file to the root of the application directory, IIS will be able to locate and host the WCF service properly.

Submit
6. You are creating a Windows Communication Foundation (WCF) service that accepts messages from clients when they are started. The message is defined as follows: [MessageContract] public class Agent {     public string CodeName { get; set; }     public string SecretHandshake { get; set; } } You have the following requirements: The CodeName property must be sent in clear text. The service must be able to verify that the property value was not changed after being sent by the client. The SecretHandshake property must not be sent in clear text and must be readable by the service. What should you do?

Explanation

To meet the requirements, the CodeName property needs to be sent in clear text and the service needs to be able to verify that the value was not changed. Therefore, the CodeName property should have a MessageBodyMember attribute with a ProtectionLevel set to Sign. This will ensure that the property is sent in clear text and that the service can verify its integrity.

Similarly, the SecretHandshake property needs to be sent in an encrypted format and readable by the service. Therefore, it should have a MessageBodyMember attribute with a ProtectionLevel set to EncryptAndSign. This will ensure that the property is encrypted and can be decrypted by the service.

Submit
7. A Windows Communication Foundation (WCF) application uses a data contract that has several data members. You need the application to throw a SerializationException if any of the data members are not present when a serialized instance of the data contract is deserialized. What should you do?

Explanation

Setting the lsRequired property of each data member to true ensures that the data contract requires all data members to be present when a serialized instance is deserialized. If any data member is missing, a SerializationException will be thrown. This is the correct approach to achieve the desired behavior.

Submit
8. You are integrating a Windows Communication Foundation (WCF) service within an enterprise-wide Service Oriented Architecture (SOA). Your service has the following service contract: [ServiceContract] public class CreditCardConfirmationService {     [OperationContract]     boolean ConfirmCreditCard(string ccNumber);         double OrderAmount(int orderNumber); } You need to allow the code in the ConfirmCreditCard method to participate automatically in existing transactions. If there is no existing transaction, a new transaction must be created automatically. What should you do?

Explanation

Adding the [OperationBehavior(TransactionScopeRequired=true)] attribute to the ConfirmCreditCard method will allow the code to participate automatically in existing transactions. If there is no existing transaction, a new transaction will be created automatically. This attribute ensures that the method is executed within a transaction scope, providing transactional support for the method.

Submit
9. 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?

Explanation

To debug and fix the communication issue, the correct approach is to enable messageLogging in the System.ServiceModel diagnostics element configuration. This allows the service to log the messages received from the client. Additionally, a listener needs to be configured for the System.ServiceModel.MessageLogging trace source to capture and analyze the logged messages.

Submit
10. A Windows Communication Foundation (WCF) client communicates with a service. You created the client proxy by using Add Service Reference in MS Visual Studio. You need to ensure that the client accepts responses of up to 5 MB in size. What should you change in the configuration file'?

Explanation

In order to ensure that the client accepts responses of up to 5 MB in size, the configuration file needs to be modified by changing the value of the maxReceivedMessageSize attribute to 5242880. This attribute specifies the maximum size of the received message that the client can handle. By setting it to 5242880, the client will be able to accept responses of up to 5 MB in size.

Submit
11. You are creating a Windows Communication Foundation (WCF) service. You do not want to expose the internal implementation at the service layer. You need to expose the following class as a service named Arithmetic with an operation named Sum: public class Calculator {     public int Add(int x, int y)     {     } } Which code segment should you use?

Explanation

The correct answer is [ServiceContract(Name="Arithmetic")]
public class Calculator
{
[OperationContract(Name="Sum")]
public int Add(int x, int y)
{}
}

This is the correct code segment because it uses the ServiceContract attribute with the Name property set to "Arithmetic" to specify the name of the service. It also uses the OperationContract attribute with the Name property set to "Sum" to specify the name of the operation. This allows the class and method to be exposed as a service named "Arithmetic" with an operation named "Sum".

Submit
12. You are creating a Windows Communication Foundation (WCF) service that responds using plain-old XML (POX). You have the following requirements: You must enable the /catalog.svc IItems operation to respond using the POX, JSON, or ATOM formats. You also must ensure that the same URL is used regardless of the result type. You must determine the response format by using the Accepts HTTP header. What should you do?

Explanation

not-available-via-ai

Submit
13. 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] void PostData(Order data); You need to modify PostData so that it can receive any SOAP message.  Which code segment should you use?

Explanation

The correct answer is [OperationContract] void PostData(Message data) because the Message class in WCF represents the entire SOAP message, including the headers and body. By using this code segment, the PostData method can receive any SOAP message, regardless of its content or structure.

Submit
14. You are creating a Windows Communication Foundation (WCF) service that implements the following service contract. [ServiceContract] public interface IOrderProcessing {     [OperationContract]     void ApproveOrder(int id); } You need to ensure that only users with the Manager role can call the ApproveOrder method. What should you do?

Explanation

The correct answer is to add a PrincipalPermission attribute to the method and set the Roles property to Manager. This will ensure that only users with the Manager role can call the ApproveOrder method. The PrincipalPermission attribute allows you to specify the roles that are required to access the method, in this case, only users with the Manager role.

Submit
15. You have a secured Windows Communication Foundation (WCF) service. You need to track unsuccessful attempts to access the service. What should you do?

Explanation

The correct answer is to set the messageAuthenticationAuditLevel attribute of the serviceSecurityAudit behavior to Failure. This will enable auditing of authentication failures for the WCF service. By setting the messageAuthenticationAuditLevel to Failure, the service will track and log unsuccessful attempts to access the service, providing valuable information for security analysis and troubleshooting.

Submit
16. You are implementing a Windows Communication Foundation (WCF) service contract named lContosoService in a class named ContosoService. The service occasionally fails due to an exception being thrown at the service. You need to send the stack trace of any unhandled exceptions to clients as a fault message. What should you do?

Explanation

By applying the [ServiceBehavior(IncludeExceptionDetailInFaults = true)] attribute to the ContosoService class, any unhandled exceptions thrown by the service will be sent as a fault message to the clients. This attribute allows the service to include exception details in the fault message, including the stack trace. This ensures that clients receive information about the exceptions that occurred on the server, helping them to diagnose and handle any errors effectively.

Submit
17. A Windows Communication Foundation (WCF) client uses the following service contract. (Line numbers are included for reference only.) 01 [ServiceContract] 02 public interface IService 03 { 04     [OperationContract] 05     string Operation1(); 06     [OperationContract] 07     string Operation2(); 08 } You need to ensure that all calls to Operation1 and Operation2 from the client are encrypted and signed. What should you do?

Explanation

Setting the ProtectionLevel property in line 01 to EncryptAndSign will ensure that all calls to Operation1 and Operation2 from the client are encrypted and signed. This means that the data being transmitted will be encrypted to protect its confidentiality and integrity, and it will also be signed to ensure that it has not been tampered with during transmission. This is the appropriate action to take in order to meet the requirement of encrypting and signing all calls to these operations.

Submit
18. You are developing a data contract for a Windows Communication Foundation (WCF) service. The data in the data contract must participate in round trips. Strict schema validity is not required. You need to ensure that the contract is forward-compatible and allows new data members to be added to it. Which interface should you implement in the data contract class?

Explanation

The correct answer is IExtensibleDataObject. By implementing the IExtensibleDataObject interface, the data contract class allows new data members to be added without breaking existing functionality. This interface provides a mechanism for adding extra data to the serialized message without requiring a strict schema validation. It ensures forward compatibility by allowing the addition of new data members without affecting existing contracts.

Submit
19. You have an existing Windows Communication Foundation (WCF) service that exposes a service contract over HTTP. You need to expose that contract over HTTP and TCP. What should you do?

Explanation

To expose the existing WCF service contract over both HTTP and TCP, you need to add an endpoint configured with a netTcpBinding. This allows the service to accept requests over TCP in addition to HTTP. By adding this endpoint, clients can now communicate with the service using either protocol.

Submit
20. 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?

Explanation

Setting the value of ServiceSecurityContext.Current.WindowsIdentity.ImpersonationLevel to TokenImpersonationLevel.Delegation allows the service to access out-of-process resources on behalf of the originating caller. Delegation impersonation level allows the service to delegate the caller's identity to another resource, such as a database or file server, allowing the service to access those resources using the caller's identity. This ensures that the service can access the necessary resources while still maintaining the security and permissions of the originating caller.

Submit
21. You are creating a Window Commnunication Foundation (WCF) service application. The application needs to service many clients and requests simultaneously. The application also needs to ensure subsequent individual client requests provide a stateful conversation. You need to configure the service to support these requirements. Which attribute should you add to the class that is implementing the service?

Explanation

The correct answer is [ServiceBehavior(InstanceContextMode = lnstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]. This attribute configuration ensures that each client request will have its own session, allowing for stateful conversations. Additionally, the ConcurrencyMode is set to Multiple, which means that multiple client requests can be processed simultaneously.

Submit
22. 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(IncludeExceptionDetailsInFaults = true)] 03 public class OrderService 04 { 05     [OperationContract] 06     public void SubmitOrder(Order anOrder) 07     { 08         try 09         { 10             ... 11         } 12         catch(DivideByZeroException 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?

Explanation

To ensure that the stack trace details of the exception are not included in the error information sent to the client, you need to add the [FaultContract(typeof(FaultException))] attribute to the service contract at line 05. This attribute specifies that the service can throw a FaultException, which is a fault message that can be sent to the client. Additionally, you should replace line 14 with the following line: throw new FaultException(anOrder, "Divide by zero exception");. This will throw a FaultException with a custom error message instead of the original exception, preventing the stack trace details from being exposed to the client.

Submit
23.  You are creating a Windows Communication Foundation (WCF) service. You need to ensure that the service is compatible with ASP.NET to make use of the session state. Which binding should you use?

Explanation

The BasicHttpContextBinding should be used in this scenario to ensure compatibility with ASP.NET session state. This binding allows the WCF service to access the HttpContext of the ASP.NET application, which includes the session state. The NetTcpContextBinding and NetTcpBinding do not provide access to the HttpContext, while the NetMsmqBinding is used for communication with Message Queuing (MSMQ) and does not support session state.

Submit
24. You have an existing Windows Communication Foundation (WCF) Web service. The Web service is not responding to messages larger than 64 KB. You need to ensure that the Web service can accept messages larger than 64 KB without generating errors. What should you do?

Explanation

To ensure that the Web service can accept messages larger than 64 KB without generating errors, the value of maxReceivedMessageSize on the endpoint binding should be increased. This setting determines the maximum size of the messages that the service can receive. By increasing this value, the Web service will be able to handle larger messages without encountering any errors.

Submit
25. A service implements the following contract. (Line numbers are included for reference only) 01 [ServiceContract(SessionMode = SessionMode.Required)] 02 public interface IContosoService 03 { 04     [OperationContract(IsOneWay = true, IsInitiating = true)] 05     void OperationOne(string value); 06 07     [OperationContract(IsOneWay = true, IsInitiating = false)] 08     void OperationTwo(string value); 09 } The service is implemented as follows: 10 class ContosoService: IContosoService 11 { 12     public void OperationOne(string value) {...} 13     ... 14     public void OperationTwo(string value) {...} 15 } ContosoService uses NetMsmqBinding to listen for messages. The queue was set up to use transactions for adding and removing messages. You need to ensure that OperationOne and OperationTwo execute under the same transaction context when they are invoked in the same session. What should you do?

Explanation

The correct answer is to insert the [OperationBehavior(TransactonScopeRequired=true, TransactionAutoComplete=false)] attribute to OperationOne on ContosoService and insert the [OperationBehavior(TransactionScopeRequired=true, TransactionAutoComplete=true)] attribute to OperationTwo on ContosoService. These attributes specify that both operations require a transaction scope and that OperationOne should not automatically complete the transaction while OperationTwo should. This ensures that both operations execute under the same transaction context when invoked in the same session.

Submit
26. 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.) 01 static void Main(string[] args) 02 { 03     ServiceHost host; 04     ... 05     host.Open(); 06     Console.ReadLine(); 07     host.Close(); 08 } 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?

Explanation

The correct line of code to insert at line 04 is "host = new ServiceHost(typeof(DataAccessService));". This is because the ServiceHost constructor requires the type of the service to be hosted, which in this case is DataAccessService.

Submit
27. A Windows Communication Foundation (WCF) service has the following contract: [ServiceContract] public class ContosoService {     [OperationContract]     [TransactionFlow(TransactionFlowOption.Mandatory)]     [OperationBehavior(TransactionScopeRequired=true, TransactionAutoComplete=false)]     void TxOp1(string value) {... };     [OperationContract(IsTerminating=true)]     [TransactionFlow(TransactionFlowOption.Mandatory)]     [OperationBehavior(TransactionScopeRequired=true, TransactionAutoComplete=false)]     void TxOp2(string value)     {         ...         OperationContext.Current.SetTransactionComplete();     } } The service and the clients that call the service use NetTcpBinding with transaction flow enabled. You need to configure the service so that when TxOp1 and TxOp2 are invoked under the same client session, they run under the same transaction context. What should you do?

Explanation

The correct answer is to update the service contract to have SessionMode as Required and add the behavior to the service implementation with InstanceContextMode as PerSession. This configuration ensures that both TxOp1 and TxOp2 are invoked under the same client session, allowing them to run under the same transaction context.

Submit
28. A Windows Communication Foundation (WCF) service sends notifications when the service is started and stopped. You need to implement a client that logs these notifications. Which class should you use?

Explanation

The correct answer is AnnouncementService. This class is the most suitable for implementing a client that logs notifications from a Windows Communication Foundation (WCF) service. The name "AnnouncementService" suggests that it is specifically designed for handling notifications and announcements. As a result, it would be the most appropriate choice for logging the notifications sent by the WCF service when it is started and stopped.

Submit
29. A Windows Communication Foundation (WCF) service implements a contract with one-way and request-reply operations. The service is exposed over a TCP transport. Clients use a router to communicate with the service. The router is implemented as follows.  (Line numbers are included for reference only.) 01 ServiceHost host = new ServiceHost(typeof(RoutingService)); 02 host.AddServiceEndpoint( 03     typeof(ISimplexDatagramRouter), 04     new NetTcpBinding(), "net.tcp://localhost/Router" 05    ); 06 List<ServiceEndpoint> lep = new List<ServiceEndpoint>(); 07 lep.Add( 08     new ServiceEndpoint( 09        ContractDescription.GetContract( 10           typeof(ISimplexDatagramRouter) 11    ), 12     new NetTcpBinding(), 13     new EndpointAddress("net.tcp://localhost:8080/Logger") 14    ) 15 ); 16 RoutingConfiguration rc = new RoutingConfiguration(); 17 rc.FilterTable.Add(new MatchAllMessageFilter(), lep); 18 host.Description.Behaviors.Add(new RoutingBehavior(rc)); Request-reply operations are failing. You need to ensure that the router can handle one-way and request-reply operations. What should you do?

Explanation

The correct answer is to change line 03 to typeof(IDuplexSessionRouter). This is because the router needs to handle both one-way and request-reply operations, and the IDuplexSessionRouter interface supports both types of operations. By changing the line to typeof(IDuplexSessionRouter), the router will be able to handle both types of operations successfully.

Submit
30. A Windows Communication Foundation (WCF) service has a callback contract. You are developing a client application that will call this service. You must ensure that the client application can interact with the WCF service. What should you do?

Explanation

Creating a proxy derived from DuplexClientBase on the client allows the client application to interact with the WCF service. DuplexClientBase provides support for duplex communication, which means that both the client and the service can send messages to each other. This is necessary when using a callback contract, as the service needs to be able to send messages back to the client. By creating a proxy derived from DuplexClientBase, the client application can establish a connection with the service and receive callback messages.

Submit
31. A Windows Communication Foundation (WCF) service implements the following contract. (Line numbers are included for reference only.) 01 [ServiceContract] 02 public interface IDataAccessService 03 { 04     [OperationContract] 05     void PutMessage(string message); 06     ... 07     [OperationContract] 08     [FaultContract(typeof(TimeoutFaultException))] 09     [FaultContract(typeof(FaultException))] 10     string SearchMessages(string search); 11 } The implementation of the SearchMessages method throws TimeoutFaultException exceptions for database timeouts. The implementation of the SearchMessages method also throws an Exception for any other issue it encounters while processing the request. These exceptions are received on the client side as generic FaultException exceptions. You need to implement the error handling code for SearchMessages and create a new channel on the client only if the channel faults. What should you do?

Explanation

The correct answer is to catch and handle TimeoutFaultException and catch FaultException and create a new channel. This is because the implementation of the SearchMessages method throws TimeoutFaultException exceptions for database timeouts and throws an Exception for any other issue. These exceptions are received on the client side as generic FaultException exceptions. Therefore, it is necessary to catch and handle TimeoutFaultException separately and create a new channel if a FaultException is caught.

Submit
32. 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?

Explanation

The correct answer is "serviceDebug". By configuring and applying the "serviceDebug" behavior to the service, the application will transmit the exceptions raised by the database to the client calling the service. This behavior allows for debugging and troubleshooting purposes by providing detailed information about any exceptions that occur during the service operation.

Submit
33. A Windows Communication Foundation (WCF) service uses the following service contract. [ServiceContract] public interface IService {     [OperationContract]     string Operation1(string s); } You need to ensure that the operation contract Operation1 responds to HTTP POST requests. Which code segment should you use?

Explanation

The correct answer is [OperationContract]
[WebInvoke(Method="POST")]
string Operation1(string s).

This code segment uses the [WebInvoke] attribute with the Method property set to "POST", which ensures that the Operation1 method responds to HTTP POST requests.

Submit
34. A Windows Communication Foundation (WCF) client configuration file contains the following XML segment in the system.serviceModel element. <client>     <endpoint address="net.tcp://server/ContosoService"         binding="netTcpBinding"         contract="Contoso.IContosoService"         name="netTcp"/>     <endpoint address="net.pipe://localhost/ContosoService"         binding="netNamedPipeBinding"         contract="Contoso.IContosoService"         name="netPipe" /> </client> You need to create a channel factory that can send messages to the endpoint listening at net.pipe://localhost/ContosoService. Which code segment should you use?

Explanation

The correct answer is "ChannelFactory factory = new ChannelFactory("netPipe");". This is because the endpoint in the client configuration file has the name attribute set to "netPipe", so when creating the channel factory, we need to pass the same name to match the endpoint.

Submit
35. A Windows Communication Foundation (WCF) solution uses two services to manage a shopping cart. Service A processes messages containing line items that total between $0 and $500. Service B processes messages containing line items that total more than $500. All messages are of equal importance to the business logic. You need to route incoming messages to the appropriate services by using WCF routing. Which two message filters should you add to the router? (Each correct answer presents part of the solution. Choose two.)

Explanation

To route incoming messages to the appropriate services, two message filters should be added to the router. The first message filter should have a priority of 100 and forward messages that total between $0 and $500 to Service A. This ensures that messages within the specified range are directed to the correct service. The second message filter should have a priority of 0 and forward all messages to Service B. This ensures that any messages not falling within the $0 to $500 range are directed to Service B.

Submit
36. You are developing a Windows Communication Foundation (WCF) service that reads messages from a public non-transactional MSMQ queue. You need to configure the service to read messages from the failed-delivery queue. Which URI should you specify in the endpoint configuration settings of the service?

Explanation

The correct answer is net.msmq://localhost/system$DeadLetter. This is because the failed-delivery queue in MSMQ is known as the Dead Letter queue, and it is located under the system queue path. Therefore, the URI should specify the system$DeadLetter queue to read messages from the failed-delivery queue.

Submit
37. A Windows Communication Foundation (WCF) service listens for messages at net.tcp://www.contoso.com/MyService. It has a logical address at https://www.contoso.com/MyService. The configuration for the WCF client is as follows: <endpoint address="https://www.contoso.com/MyService"     binding="netTcpBinding"     bindingConfiguraton="NetTcpBinding_IMyService"     contract="ServiceReference1.IMyService"     name="NetTcpBinding_IMyService"/> The generated configuration does not provide enough information for the client to communicate with the server. You need to update the client so that it can communicate with the server. What should you do?

Explanation

The correct answer is to add the line of code "client.Endpoint.Behaviors.Add(new ClientViaBehavior(new Uri("net.tcp://www.contoso.com/IMyService")));". This code adds a behavior to the client's endpoint, specifically the ClientViaBehavior, which allows the client to specify a different URI for sending messages. In this case, it sets the URI to "net.tcp://www.contoso.com/IMyService", which matches the URI of the server's net.tcp endpoint. This ensures that the client can communicate with the server using the correct URI.

Submit
38. 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 Catalog {      [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?

Explanation

The correct code segment to deserialize the response into a strongly typed object representing the return value of the method is:

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

This code uses the DataContractSerializer to deserialize the response stream into an object of type Item. The ReadObject method is used to read and deserialize the stream, and the result is cast to the Item type.

Submit
39. 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 foreach (SyndicationItem item in feed.Items) 02 { 03 } You need to display the content type and body of every syndication item to the console. Which two lines of code should ou insert between lines 02 and 03?

Explanation

The correct answer is to insert the following two lines of code between lines 02 and 03:

Console.WriteLine(item.Content.Type);
Console.WriteLine(((TextSyndicationContent)item.Content).Text);

These lines of code will display the content type and body of each syndication item to the console.

Submit
40. 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 [ServiceContract] 02 public interface ITeamMessageService 03 { 04     [OperationContract] 05     string GetMessage(); 07    [OperationContract] 08     void PutMessage(string message); 09 } The code for the service class is as follows: 10 public class TeamMessageService: ITeamMessageService 11 { 12     Guid key = Guid.NewGuid(); 13     string message = "Today's Message"; 14     public string GetMessage() 15     { 16         return stringFormat("Message:{0} Key:{1}", 17             message, key); 18   } 19     public void PutMessage(string message) 20     { 21         this.message = message; 22     } 23 } The service is self-hosted. The hosting code is as follows: 24 ServiceHost host = new ServiceHost(typeof(TeamMessageService)); 25 BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None): 26 host.AddServiceEndpoint(MyApplication.ITeamMessageService, binding, "https://localhost:12345"); 27 host.Open(); You need to ensure that all clients calling GetMessage will retrieve the same string, even if the message is updated by clients calling PutMessage. What should you do

Explanation

Adding the [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] attribute to the TeamMessageService class ensures that only one instance of the service class is created and shared among all clients. This means that all clients calling GetMessage will retrieve the same string, even if the message is updated by clients calling PutMessage.

Submit
41. You are developing a Windows Communication Foundation (WCF) service. You write a method named Submit that accepts messages of the type System.ServiceModel.Channels.Message. You need to process the body of the incoming messages multiple times in the method. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

Explanation

The correct answer is to use the CreateBufferedCopy method of the Message class to load the messages into memory and to use the CreateMessage method of the MessageBuffer class to make a copy of the messages.

By using the CreateBufferedCopy method, the messages are loaded into memory, allowing them to be processed multiple times within the method. This method creates a buffered copy of the original message, which can be accessed and processed multiple times without affecting the original message.

Additionally, by using the CreateMessage method of the MessageBuffer class, a copy of the messages can be made. This allows for further processing or manipulation of the messages without modifying the original message.

Submit
42. You are building a client for a Windows Communication Foundation (WCF) service. You need to create a proxy to consume this service. Which class should you use?

Explanation

The correct answer is ChannelFactory. In WCF, a ChannelFactory is used to create a channel that can be used to communicate with a service. It provides methods to create a channel of a specified type and configure the channel's behavior. The ChannelFactory class is typically used on the client side to create a proxy that can consume the service.

Submit
43. A Windows Communication Foundation (WCF) solution uses the following contracts. (Line numbers are included for reference only.) 01 [ServiceContract(CallbackContract=typeof(INameService))] 02 public interface IGreetingService 03 { 04     [OperationContract] 05     string GetMessage(); 06 } 07 08 [ServiceContract] 09 public interface INameService 10 { 11     [OperationContract] 12     string GetName(); 13  } When the client calls GetMessage on the service interface, the service calls GetName on the client callback. In the client, the class NameService implements the callback contract. The client channel is created as follows: 22 InstanceContext callbackContext = new InstanceContext(new NameService("client")); 23 ... 24 ... 25 DuplexChannelFactory<IGreetingService> factory = new DuplexChannelFactory<IGreetingService>(typeof(NameService), binding, address); 26 IGreetingService greetingService = factory.CreateChannel(); You need to ensure that the service callback is processed by the instance of NameService. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution.  Choose two.)

Explanation

The first possible way to achieve the goal is to change line 25 to the code segment "DuplexChannelFactory factory = new DuplexChannelFactory(callbackContext, binding, address);". This ensures that the callback context is passed to the DuplexChannelFactory, allowing the service callback to be processed by the instance of NameService.

The second possible way is to change line 26 to the code segment "IGreetingService greetingServicefactory = CreateChannel(callbackContext);". This creates the channel using the CreateChannel method with the callback context parameter, ensuring that the service callback is processed by the instance of NameService.

Submit
44. A Windows Communication Foundation (WCF) solution provides a session-based counter. The service is self-hosted. The hosting code is as follows: ServiceHost host = new ServiceHost(typeof(CounterService)); NetTcpBinding binding1 = new NetTcpBinding(SecurityMode.None); host.AddServiceEndpoint("MyApplication.ICounterService", binding1, "net.tcp://localhost:23456"); host.Open(); This service is currently exposed over TCP, but needs to be exposed to external clients over HTTP. Therefore, a new service endpoint is created with the following code: host.AddServiceEndpoint("MyApplication.ICounterService", binding2, "https://localhost:12345"); You need to complete the implementation and ensure that the session-based counter will perform over HTTP as it does over TCP. What should you do?

Explanation

not-available-via-ai

Submit
45. You are consuming a Windows Communication Foundation (WCF) service in an ASP. NET Web application. The service interface is defined as follows: [ServiceContract] public interface ICatalog {     [OperationContract]     [WebGet(UriTemplate="/Catalog/Items/{id}", ResponseFormat=WebMessageFormat.Json)]     string RetrieveItemDescription(int id); } The service is hosted at Catalogsvc. You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemId. Which code segment should you use?

Explanation

The correct code segment to use is $get(String.format("/Catalogsvc/Catalog/Items/{0}", itemId), null, function (data) {
...
}, "json"). This is because the RetrieveItemDescription method in the service interface is decorated with the [WebGet] attribute, which specifies a UriTemplate of "/Catalog/Items/{id}". This means that the URL to retrieve the item description should be in the format "/Catalogsvc/Catalog/Items/{id}", where {id} is the id of the item. The code segment correctly uses String.format to substitute the {0} placeholder with the value of the itemId variable. The "json" parameter in the code segment specifies that the response format should be JSON.

Submit
46. Your Windows Communication Foundation (WCF) client application uses HTTP to communicate with the service. You need to enable message logging and include all security information such as tokens and nonces in logged messages. What should you do?

Explanation

To enable message logging and include all security information such as tokens and nonces in logged messages, you need to add the XML segment mentioned in the machine configuration file to the system.serviceModel configuration section. This will configure the WCF client application to log the messages and include the necessary security information. Additionally, there is no need to generate the ContosoService class using the Add Service Reference wizard or add the SoapProcessingBehavior code segment. The IogKnownPii attribute and XML segment in the application configuration file are not relevant for this requirement.

Submit
47. A Windows Communication Foundation (WCF) solution exposes the following contract over an HTTP connection. [ServiceContract] public interface IDataService {     [OperationContract]     string GetData(); } Existing clients are making blocking calls to GetData.  Calls to GetData take five seconds to complete. You need to allow new clients to issue non-blocking calls to get the data, without breaking any existing clients. What should you do?

Explanation

The correct answer is to generate a proxy class with asynchronous methods and use it for the new clients. By generating a proxy class with asynchronous methods, new clients can issue non-blocking calls to get the data. This means that the new clients will not have to wait for the GetData call to complete before continuing with their operations. This solution allows for concurrent execution of multiple operations, improving the overall performance and responsiveness of the system without affecting the existing clients.

Submit
48. A WCF service code is implemented as follows. (Line numbers are included for reference only) 01 [ServiceContract] 02 [ServiceBehavior(InstanceContextMode = 03 InstanceContextMode.Single)] 04 public class CalculatorService 05 { 06     [OperationContract] 07     public double Calculate(double op1, string op, double op2) 08     { 09     } 10 } You need to increase the rate by which clients get the required response from the service. What are two possble ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

Explanation

Changing the service behavior to [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Multiple)] allows multiple clients to access the service simultaneously, increasing the rate at which clients get the required response. This is because the service instance is shared among multiple clients, allowing them to execute concurrently. Similarly, changing the service behavior to [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall)] creates a new service instance for each client request, allowing multiple clients to be served simultaneously and improving the response rate.

Submit
49. A Windows Communication Foundation (WCF) service that handles corporate accounting must be changed to comply with government regulations of auditing and accountability. You need to configure the WCF service to execute under the Windows logged-on identity of the calling application. What should you do?

Explanation

To configure the WCF service to execute under the Windows logged-on identity of the calling application, you need to add a ServiceAuthorization behavior to the service configuration and set ImpersonateCallerForAllOperations to true. This will allow the service to impersonate the caller's identity for all operations, ensuring that the service executes with the appropriate permissions and complies with government regulations of auditing and accountability.

Submit
50. A Windows Communication Foundation (WCF) client and service share the following service contract interface: [ServiceContract] public interface IContosoService {     [OperationContract]     void SavePerson(Person person); } They also use the following binding: NetTcpBinding binding = new NetTcpBinding() { TransactionFlow = true }; The client calls the service with the following code: using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) {     IContosoService client = factory.CreateChannel();     client.SavePerson(person);     Console.WriteLine(Transaction.Current.TransactionInformation.DistributedIdentifier);     ts.Complete(); } The service has the following implementation for SavePerson: public void IContosoService.SavePerson(Person person) {     person.Save();     Console.WriteLine(Transaction.Current.TransactionInformation.DistributedIdentifier); } The distributed identifiers do not match on the client and the server. You need to ensure that the client and server enlist in the same distributed transaction. What should you do?

Explanation

The correct answer is to add the following attribute to the SavePerson operation on lContosoService: [TransactionFlow(TransactionFlowOption.Allowed)]. This allows the client and server to participate in the same distributed transaction. Additionally, the implementation of SavePerson should have the attribute [OperationBehavior(TransactionScope.Required = true)] to ensure the transaction is required for the operation.

Submit
51. 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?

Explanation

By declaring all of the body members as properties of a DataContract class and using the class as the only body member of the message contract, the XML representation of the message contract will be simplified. This approach ensures that all body members share the same namespace declaration, eliminating the need for separate namespace declarations for each body member.

Submit
52. A Windows Communication Foundation (WCF) application uses the following data contract [DataContract] public class Person {     [DataMember]     public string firstName;     [DataMember]     public string lastName;     [DataMember]     public int age;     [DataMember]     public int ID;     } You need to ensure that the following XML segment is generated when the data contract is serialized. <Person>     <firstName xsi:nil="true"/>     <lastName xsi:nil="true"/>     <ID>999999999<ID> </Person> Which code segment should you use?

Explanation

The correct answer is to use the code segment:
[DataMember]
public string firstName = null;
[DataMember]
public string lastName = null;
[DataMember(EmitDefaultValue = false)]
public int age = 0;
[DataMember(EmitDefaultValue = false)]
public int ID = 999999999;

This code segment ensures that the firstName and lastName properties are serialized as empty elements by setting them to null. The age property is set to 0 and the ID property is set to 999999999, which are the desired values for serialization. The EmitDefaultValue property is set to false for all properties to prevent the default values from being serialized.

Submit
53. A Windows Communication Foundation (WCF) solution exposes the following service over a TCP binding. (Line numbers are included for reference only.) 01 [ServiceContract] 02 [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] 03 public class DataAccessService 04 { 05     [OperationContract] 06     public void PutMessage(string message) 07     { 08         MessageDatabase.PutMessage(message); 09     } 10     [OperationContract] 11     pubic string[] SearchMessages(string search) 12     { 13         return MessageDatabase.SearchMessages(search); 14     } 15 } 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?

Explanation

To allow up to the maximum number of executions of the methods of MessageDatabase without preventing customers from connecting to the service, a throttling behavior needs to be added to the service and the maxConcurrentCalls should be configured. This will limit the number of concurrent calls to the service and ensure that the maximum number of executions of the methods is not exceeded.

Submit
54. An ASP.NET application hosts a RESTful Windows Communication Foundation (WCF) service at /Services/Contoso.svc. The service provides a JavaScript resource to clients. You have an explicit reference to the JavaScript in your page markup as follows. <script type="text/javaScript" src="/Services/Contoso.svc/js" /> You need to retrieve the debug version of the service JavaScript. What should you do?

Explanation

To retrieve the debug version of the service JavaScript, you should append "debug" to the src attribute in the script tag. This will ensure that the debug version of the JavaScript is requested from the server.

Submit
55. You are modifying an existing Windows Communication Foundation (WCF) service that is defined as follows: [ServiceContract] public interface IMessageProcessor {     [OperationContract]     void ProcessMessages(); } public class MessageProcessor: IMessageProcessor     {      public void ProcessMessage();      SubmitOrder(); } 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?

Explanation

The correct answer is ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Reentrant). This attribute should be applied to the MessageProcessor class in order to enable processing of multiple messages. The ConcurrencyMode.Reentrant setting allows the ProcessMessage method to handle multiple requests simultaneously, while also allowing it to wait for calls to SubmitOrder to return. This ensures that new messages are only processed when the ProcessMessage method is not already processing requests.

Submit
56. A class named TestService implements the following interface:      [ServiceContract] public interface ITestService {     [OperationContract]     DateTime GetServiceTime(); } TestService is hosted in an ASP.NET application. You need to modify the application to allow the GetServiceTime method to return the data formatted as JSON. It must do this only when the request URL ends in /ServiceTime. What should you do?

Explanation

The correct answer is to add the attribute [WebGet(ResponseFormat=WebMessageFormat.Json, UriTemplate="/ServiceTime")] to the GetServiceTime method. This attribute specifies that the method should be invoked using the HTTP GET method, and the response should be formatted as JSON. The UriTemplate="/ServiceTime" ensures that this behavior is applied only when the request URL ends in /ServiceTime.

Submit
57. You are using Windows Communication Foundation (WCF) to create a service. You need to implement a custom message-level security binding element. Which binding element should you use?

Explanation

The correct answer is TransportSecurityBindingElement. This is because the question asks for a custom message-level security binding element, and TransportSecurityBindingElement is specifically designed for securing messages at the transport level. HttpsTransportBindingElement is used for securing messages over HTTPS, SslStreamSecurityBindingElement is used for securing messages using SSL/TLS, and WindowsStreamSecurityBindingElement is used for securing messages using Windows authentication. None of these options are specifically designed for custom message-level security.

Submit
58. A Windows Communication Foundation (WCF) solution uses the following contract: [ServiceContract(SessionMode=SessionMode.Allowed)] public interface IMyService {     [OperationContract(IsTerminating=false)]     void Initialize();     [OperationContract(IsInitiating=false)]     void DoSomething();     [OperationContract(IsTerminating=true)]     void Terminate(); } You need to change this interface so that: lnitialize is allowed to be called at any time before Terminate is called. DoSomething is allowed to be called only after Initialize is called, and not allowed to be called after Terminate is called. Terminate will be allowed to be called only after Initalize is called. Which two actions should you perform? (Each correct answer presents part of the sdution. Choose two)

Explanation

The correct answer is to change the ServiceContract attribute of the IMyService interface to [ServiceContract(SessionMode=SessionMode.Required)] and to change the OperationContract attribute of the Terminate operation to [OperationContract(IsInitiating = false, IsTerminating = true)].

By changing the ServiceContract attribute to SessionMode.Required, it ensures that a session is required for all operations in the contract. This means that the Initialize operation can be called at any time before Terminate is called.

By changing the OperationContract attribute of the Terminate operation to IsInitiating = false and IsTerminating = true, it ensures that Terminate can only be called after Initialize is called. Additionally, by setting IsTerminating = true, it ensures that Terminate is the last operation that can be called in the session.

Submit
59. 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?

Explanation

The correct answer is to create one FindCriteria object for each interface and set the Duration of each FindCriteria to two seconds. Then, 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. Finally, run the loop until a service is found or 30 seconds pass. This approach allows the client to discover services implementing both interfaces within a 30-second time limit by continuously searching for the services using the Find method.

Submit
60. A Windows Communication Foundation (WCF) service implements the following contract. [ServiceContract] public interface IHelloService {     [OperationContract(WebGet(UriTemplate="hello?name={name}"))]     string SayHello(string name); } The implementation is as follows: public class HelloService: IHelloService {      public string SayHello(string name)      {         return "Hello " + name;      } } The service is self-hosted, and the hosting code is as follows: WebServiceHost svcHost = CreateHost(); svcHost.Open(); Console.ReadLine(); svcHost.Close(); You need to implement CreateHost so that the service has a single endpoint hosted at https://localhost:8000/HelloService. Which code segment should you use?

Explanation

The correct code segment to implement the CreateHost method is:

Uri baseAddress = new Uri("http://localhost:8000");
WebServiceHost svcHost = new WebServiceHost(typeof(HelloService), baseAddress);
svcHost.AddServiceEndpoint(typeof(IHelloService),
new WebHttpBinding(WebHttpSecurityMode.None),
"HelloService");
return svcHost;

This code segment creates a new instance of the WebServiceHost class, passing in the type of the HelloService class and the base address. It then adds a service endpoint for the IHelloService contract using a WebHttpBinding with no security. The endpoint address is set to "HelloService". Finally, it returns the created WebServiceHost instance. This configuration ensures that the service is hosted at http://localhost:8000/HelloService.

Submit
61. A Windows Communication Foundation (WCF) solution uses the following contracts. (Line numbers are included for reference only.) 01 [ServiceContract(CallbackContract=typeof(INameService))] 02 public interface IGreetingService 03 { 04     [OperationContract] 05     string GetMessage(); 06 } 07 [ServiceContract] 08 public interface INameService 09 { 10     [OperationContract] 11     string GetName(); 12 } The code that implements the IGreetingService interface is as follows: 20 public class GreetingService : IGreetingService 21{ 22     public string GetMessage() 23     { 24         INameService clientChannel = OperationContext.Current.GetCallbackChannel<INameService>(); 25         string clientName = clientChannel.GetName(); 26         return String.Format("Hello {0}", clientName); 27     } 28 } The service is self-hosted. The hosting code is as follows: 30 ServiceHost host = new ServiceHost(typeof(GreetingService)); 31 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None); 32 host.AddServiceEndpoint("MyApplication.IGreetingService", binding, "net.tcp//localhost:12345"); 33 host.Open(); The code that implements the lNameService interface is as follows: 40 class NameService : INameService 41 { 42     string name; 43     public NameService(string name) 44     { 45         this.name = name; 46     } 47     public string GetName() 48     { 49         return name; 50     } 51 } Currently, this code fails at runtime, and an InvalidOperationException is thrown at line 25. You need to correct the code so that the call from the service back to the client completes successfully. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

Explanation

Adding the [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)] attribute to the GreetingService class before line 20 allows the service to handle multiple requests concurrently and reenter the same operation if necessary. This ensures that the call from the service back to the client completes successfully without causing an InvalidOperationException at line 25. Similarly, adding the [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)] attribute to the GreetingService class before line 20 also allows the service to handle multiple requests concurrently and resolves the runtime failure.

Submit
62. A Windows Communication Foundation (WCF) service has the following contract. [ServiceContract(Namespace="https://contoso.com")] public interface IShipping {     [OperationContract]     string DoWork(int id); } This is one of several service contracts hosted by your application. All endpoints use SOAP 1.2 bindings with WS-Addressing 1.0. The System.ServiceModel.MessageLogging trace source in the system.diagnostics configuration section is configured with one listener. You need to make sure that only the messages that are returned from the DoWork operation are logged. Which XML segment should you add to the system.serviceModel/diagnostics/messageLogging/filters configuration element?

Explanation

The correct XML segment to add to the system.serviceModel/diagnostics/messageLogging/filters configuration element is /addr:Action[text()='http://contoso.com/lShipping/DoWorkResponse']. This segment specifies that only messages with the action value of 'http://contoso.com/lShipping/DoWorkResponse' should be logged.

Submit
63. You are working with a Windows Communication Foundation (WCF) client application that has a generated proxy named SampleServiceProxy. When the client application is executing, in line 04 of the following code, the channel faults (Line numbers are included for reference only.)      01 SampleServiceProxy proxy = new SampleServiceProxy(); 02 try 03 { 04     proxy.ProcessInvoice(invoice); 05 } 06 catch 07 { 08     if(proxy.State == CommunicationState.Faulted) 09     { 10         ... 11     } 12 } 13 proxy.UpdateCustomer(customer); You need to return proxy to a state in which it can successfully execute the call in line 13. Which code segment should you use at line 10?

Explanation

At line 10, the code segment "proxy = new SampleServiceProxy();" should be used. This code segment creates a new instance of the SampleServiceProxy, effectively resetting the proxy to a state where it can successfully execute the call in line 13.

Submit
64. You have an existing Windows Communication Foundation (WCF) service. You need to ensure that other services are notified when the service is started. What should you do?

Explanation

By adding a service behavior with the specified element, you can configure the service to notify other services when it is started. This element likely contains the necessary settings or configurations to enable this notification functionality.

Submit
65. The following is an example of a SOAP envelope.      <s:Envelope xmlns:s="https://schemas.xmlsoap.org/soap/envelope">     <s:Header>         <h:StoreId xmlns:h="https://www.contoso.com">6495</h:StoreId>     </s:Header>     <s:Body>         <CheckStockRequest xmlns="https://www.contoso.com">             <ItemId>2469<ItemId>         </CheckStockRequest>     </s: Body> </s:Envelope> You need to create a message contract that generates the SOAP envelope. Which code segment should you use?

Explanation

The correct answer is [MessageContract(WrapperNamespace="http://www.contoso.com")]. This is because the given SOAP envelope has a namespace of "http://www.contoso.com" defined in the Envelope element. To generate a SOAP envelope that matches this structure, the MessageContract attribute should specify the same namespace using the WrapperNamespace property. Additionally, the StoreId property should have the MessageHeader attribute with the same namespace specified, and the ItemId property should have the MessageBodyMember attribute.

Submit
66. A Windows Communication Foundation (WCF) service exposes two operations: OpA and OpB. OpA needs to execute under the client's identity, and OpB needs to execute under the service's identity. You need to configure the service to run the operations under the correct identity. What should you do?

Explanation

The correct answer is to set the ImpersonateCallerForAllOperations property of the service's ServiceAuthorizationBehavior to false, apply an OperationBehavior attribute to OpA and set the Impersonation property to ImpersonationOption.Allowed, and apply an OperationBehavior attribute to OpB and set the Impersonation property to ImpersonationOption.NotAllowed. This configuration ensures that OpA executes under the client's identity and OpB executes under the service's identity. By setting ImpersonateCallerForAllOperations to false, the service will not impersonate the caller for all operations. The OperationBehavior attributes on OpA and OpB further specify the impersonation options for each operation.

Submit
67. You are developing a Windows Communication Foundation (WCF) service that will be hosted in Microsoft Internet Information Services (IIS) 7.0. The service must be hosted in an lIS application named Info. You need to enable this service to be hosted in llS by changing the web.config file. Which XML segment should you add to the web.config file?

Explanation

not-available-via-ai

Submit
68. Windows Communication Foundation (WCF) service is self-hosted in a console application. The service implements the lTimeService service interface in the TimeService class. You need to configure the service endpoint for HTTP communication. How should you define the service and endpoint tags?

Explanation

not-available-via-ai

Submit
69. 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 counter group. Which element should you add to the system.serviceModel section in the application configuration file?

Explanation

The element that needs to be added to the system.serviceModel section in the application configuration file is . This element enables all performance counter instances exposed by the ServiceModelService counter group, allowing for monitoring of the health of the WCF service in production.

Submit
70. Four Windows Communication Foundation (WCF) services are hosted in Microsoft Internet Information Services (IIS). No behavior configuration exists in the web.config fiIe. 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?

Explanation

not-available-via-ai

Submit
View My Results

Quiz Review Timeline (Updated): Oct 29, 2024 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Oct 29, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 27, 2012
    Quiz Created by
    Akshansh
Cancel
  • All
    All (70)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
You are creating a Windows Communication Foundation (WCF) service that...
A Windows Communication Foundation (WCF) service is responsible for...
You are creating a Windows Communication Foundation (WCF) service to...
You are creating a Windows Communication Foundation (WCF) service. You...
Windows Communication Foundation (WCF) service will be hosted in...
You are creating a Windows Communication Foundation (WCF) service that...
A Windows Communication Foundation (WCF) application uses a data...
You are integrating a Windows Communication Foundation (WCF) service...
A Windows Communication Foundation (WCF) application exposes a service...
A Windows Communication Foundation (WCF) client communicates with a...
You are creating a Windows Communication Foundation (WCF) service. You...
You are creating a Windows Communication Foundation (WCF) service that...
You are developing a client that sends several types of SOAP messages...
You are creating a Windows Communication Foundation (WCF) service that...
You have a secured Windows Communication Foundation (WCF) service....
You are implementing a Windows Communication Foundation (WCF) service...
A Windows Communication Foundation (WCF) client uses the following...
You are developing a data contract for a Windows Communication...
You have an existing Windows Communication Foundation (WCF) service...
You are developing a Windows Communication Foundation (WCF) service....
You are creating a Window Commnunication Foundation (WCF) service...
You are creating a Windows Communication Foundation (WCF) service that...
 You are creating a Windows Communication Foundation (WCF)...
You have an existing Windows Communication Foundation (WCF) Web...
A service implements the following contract. (Line numbers are...
A Windows Communication Foundation (WCF) service is self-hosted in a...
A Windows Communication Foundation (WCF) service has the following...
A Windows Communication Foundation (WCF) service sends notifications...
A Windows Communication Foundation (WCF) service implements a contract...
A Windows Communication Foundation (WCF) service has a callback...
A Windows Communication Foundation (WCF) service implements the...
A Windows Communication Foundation (WCF) service interacts with the...
A Windows Communication Foundation (WCF) service uses the following...
A Windows Communication Foundation (WCF) client configuration file...
A Windows Communication Foundation (WCF) solution uses two services to...
You are developing a Windows Communication Foundation (WCF) service...
A Windows Communication Foundation (WCF) service listens for messages...
You are consuming a Windows Communication Foundation (WCF) service....
A Windows Communication Foundation (WCF) client application is...
A Windows Communication Foundation (WCF) solution uses the following...
You are developing a Windows Communication Foundation (WCF) service....
You are building a client for a Windows Communication Foundation (WCF)...
A Windows Communication Foundation (WCF) solution uses the following...
A Windows Communication Foundation (WCF) solution provides a...
You are consuming a Windows Communication Foundation (WCF) service in...
Your Windows Communication Foundation (WCF) client application uses...
A Windows Communication Foundation (WCF) solution exposes the...
A WCF service code is implemented as follows. (Line numbers are...
A Windows Communication Foundation (WCF) service that handles...
A Windows Communication Foundation (WCF) client and service share the...
A Windows Communication Foundation (WCF) service is generating a...
A Windows Communication Foundation (WCF) application uses the...
A Windows Communication Foundation (WCF) solution exposes the...
An ASP.NET application hosts a RESTful Windows Communication...
You are modifying an existing Windows Communication Foundation (WCF)...
A class named TestService implements the following interface:...
You are using Windows Communication Foundation (WCF) to create a...
A Windows Communication Foundation (WCF) solution uses the following...
You are implementing a Windows Communication Foundation (WCF) client...
A Windows Communication Foundation (WCF) service implements the...
A Windows Communication Foundation (WCF) solution uses the following...
A Windows Communication Foundation (WCF) service has the following...
You are working with a Windows Communication Foundation (WCF) client...
You have an existing Windows Communication Foundation (WCF) service....
The following is an example of a SOAP envelope....
A Windows Communication Foundation (WCF) service exposes two...
You are developing a Windows Communication Foundation (WCF) service...
Windows Communication Foundation (WCF) service is self-hosted in a...
You are moving a Windows Communication Foundation (WCF) service into...
Four Windows Communication Foundation (WCF) services are hosted in...
Alert!

Advertisement