单项选择题
You are developing a Windows Communication Foundation (WCF) service that executes a long-running operation.The service is accessed from your business applications in a server transaction in which the client does not participate.You need to ensure that the transaction times out and aborts if the operation has not completed within 45 seconds.
What should you do?()
A. Set the service binding sendTimeout attribute to 00:00:45.
B. Apply [ServiceBehavior(TransactionTimeout="00:00:45")] to the service implementation.
C. Set the service binding receiveTimeout attribute to 00:00:45.
D. Apply [OperationBehavior(TransactionScopeRequired=false)] to the service operation.
相关考题
-
单项选择题
A Windows Communication Foundation (WCF) service is deployed with netTcpBinding. This service uses a duplex message exchange pattern.You are developing the next version of the WCF service. You discover that your companys hardware load balancer performs correctly only for WCF services that use HTTP. You need to ensure that your service works with the load balancer. What should you do?()
A. Use basicHttpBinding.
B. Create a custom binding that has the compositeDuplex, textMessageEncoding, and namedPipeTransport binding elements in this order.
C. Create a custom binding that has the compositeDuplex, textMessageEncoding, and wsHttpTransport binding elements in this order.
D. Use wsHttpBinding. -
多项选择题
You are developing a Windows Communication Foundation (WCF) service to provide shopping cart support. ASP.NET compatibility mode is not enabled. The shopping cart information must be retained across user visits to the store until the user explicitly empties the cart or submits the cart contents to order.You need to implement the service as a DurableService.Which two actions should you perform? ()(Each correct answer presents part of the solution. Choose two.)
A. Use basicHttpBinding for both the client application and the service.
B. Create the persistence provider database and configure the persistenceProvider element of the service behavior to point to that database.
C. Use wsHttpContextBinding for both the client application and the service.
D. In the method to add an item to the shopping cart, serialize the shopping cart contents after adding the current item and storing it in a Session variable. -
单项选择题
You are developing a Windows Communication Foundation (WCF) service.One of the service operations contains the following code.private static int counter = 0;[OperationContract]public void IncrementCount(){ counter++;}You need to set a service behavior that prevents two or more threads from incrementing the counter variable at the same time. Which code segment should you use to set the service behavior?()
A. [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]
B. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]
C. [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
D. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Reentrant)]
