单项选择题
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)]
相关考题
-
单项选择题
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.) 01 Guid multiCallActivityId = Guid.NewGuid(); 02 TraceSource ts = new TraceSource("Multicall"); 03 Trace.CorrelationManager.ActivityId = multiCallActivityId; 04You 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?()
A.
B.
C.
D. -
单项选择题
You are developing a Windows Communication Foundation (WCF) service. Client applications require reliable sessions to access the service.Users report that they receive ServerTooBusyException errors when their client application tries to establish a session. You need to ensure that the service can handle a minimum of 30 client connection requests. Which ReliableSessionBindingElement property should you configure?()
A. MaxRetryCount
B. MaxTransferWindowSize
C. MaxPendingChannels
D. InactivityTimeout -
单项选择题
You are developing an application that performs file backups in the background. The background application will host a Windows Communication Foundation (WCF) service and must be active as soon as the machine is running. The background application will not have a user interface. A front-end application will consume the WCF service and will provide the user interface.You need to choose a host environment for the WCF service. Which hosting environment should you choose? ()
A. Microsoft Internet Information Services (IIS) 6.0
B. Windows Process Activation Services (WAS)
C. A Windows Forms application
D. A Windows Service
