Which attribute should you add to the class that is implementing the service?

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?

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?

A.
[ServiceBehavior(lnstanceContextMode = lnstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]

B.
[ServiceBehavior(lnstanceContextMode = lnstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Reentrant)]

C.
[ServiceBehavior(InstanceContextMode = lnstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]

D.
[ServiceBehavior(lnstanceContextMode = lnstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple)]

Explanation:
many clients and requests simultaneously –> ConcurrencyMode.Multiple
requests provide a stateful conversation –> lnstanceContextMode.PerSession

ConcurrencyMode Enumeration
(http://msdn.microsoft.com/en-us/library/system.servicemodel.concurrencymode.aspx)

InstanceContextMode Enumeration
(http://msdn.microsoft.com/en-us/library/system.servicemodel.instancecontextmode.aspx)



Leave a Reply 1

Your email address will not be published. Required fields are marked *