单项选择题
You are developing a Windows Communication Foundation (WCF) service that allows customers to update financial data. The client applications call the service in a transaction. The service contract is defined as follows. (Line numbers are included for reference only.)
01 [ServiceContract]
02 public interface IDataUpdate
03 {
04 [OperationContract]
05 [TransactionFlow(TransactionFlowOption.Mandatory)]
06 void Update(string accountNumber, double amount);
07 }
08
09 ...
10 class UpdateService : IDataUpdate
11 {
12 [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]13 public void Update(string accountNumber, double amount)
14 {
15 try
16 {
17 ...
18 }
19 catch(Exception ex)
20 {
21 WriteErrorLog(ex);
22 ...
23 }
24 }
25 }
26Customers report that the transaction completes successfully even if the Update method throws an exception.You need to ensure that the transaction is aborted if the Update method is not successful.
What should you do? ()
A. Insert the following line at line 22: throw;
B. Insert the following line at line 09: [ServiceBehavior(TransactionAutoCompleteOnSessionClose=false)]
C. Replace line 12 with the following line: [OperationBehavior(TransactionScopeRequired=true, TransactionAutoComplete= false)]
D. Insert the following line at line 09.: [ServiceBehavior(TransactionAutoCompleteOnSessionClose=true)]
相关考题
-
单项选择题
You are developing a Windows Communication Foundation (WCF) service that must be discoverable.You need to ensure that the ServiceHost instance supports multiple discovery versions. What should you do?()
A. - Specify a unique DiscoveryVersion parameter for each endpoint constructor. - Use the same value for the Address property of each endpoint.
B. - Use the endpoint constructor without the DiscoveryVersion parameter. - Use a unique value for the Address property of each endpoint.
C. - Specify a unique DiscoveryVersion parameter for each endpoint constructor. - Use a unique value for the Address property of each endpoint.
D. - Use the endpoint constructor without the DiscoveryVersion parameter. - Use the same value for the Address property of each endpoint. -
单项选择题
You are developing a Windows Communication Foundation (WCF) service. You establish that the largest size of valid messages is 8,000 bytes. You notice that many malformed messages are being transmitted.Detailed information about whether each message is malformed must be logged.You need to ensure that this information is saved in XML format so that it can be easily analyzed. What should you add to the service configuration file?()
A.
B.
C.
D. -
单项选择题
You are developing a new version of an existing message contract named CustomerDetailsVersion1. The new version of the message contract must add a Department field of type String to the SOAP header.You create a new class named CustomerDetailsVersion2 that inherits from CustomerDetailsVersion1. You need to ensure that all client applications can consume the service. Which code segment should you use?()
A.
B.
C.
D.
