ConcurrencyMode, propriété

CallbackBehaviorAttribute.ConcurrencyMode, propriété

Gets or sets whether a service supports one thread, multiple threads, or reentrant calls.

Espace de noms: System.ServiceModel
Assembly : System.ServiceModel (dans system.servicemodel.dll)

public ConcurrencyMode ConcurrencyMode { get; set; }
/** @property */
public ConcurrencyMode get_ConcurrencyMode ()

/** @property */
public void set_ConcurrencyMode (ConcurrencyMode value)

public function get ConcurrencyMode () : ConcurrencyMode

public function set ConcurrencyMode (value : ConcurrencyMode)

Non applicable.

Valeur de la propriété

One of the ConcurrencyMode values; the default is Single.

Type d'exceptionCondition

ArgumentOutOfRangeException

The value is not one of the ConcurrencyMode values.

This property indicates whether an instance of a callback object supports one thread or multiple threads that execute concurrently, and if single-threaded, whether reentrancy is supported.

Setting ConcurrencyMode to Single instructs the system to restrict instances of the service to one thread of execution at a time, which frees you from dealing with threading issues. This is the default value. A value of Multiple means that service objects can be executed by multiple threads at any one time. In this case, you must ensure thread safety and state consistency.

Reentrant also restricts access to a single thread at a time. However, it enables calls out from an executing service method to return and reenter the executing service. A reentrant call can execute on a different managed thread, but in this case the original thread is blocked for the duration of the reentrant call.

Generally, if a message arrives for an instance that violates its concurrency mode, the message waits until the instance is available, or until it times out.

In addition, if the ConcurrencyMode is set to Single and a reentrant call is blocked while waiting for the instance to be freed, the system detects the deadlock and throws an exception.

For more details about concurrency, see ServiceBehaviorAttribute.ConcurrencyMode and Sessions, Instancing, and Concurrency.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition

Microsoft .NET Framework 3.0 est pris en charge sur Windows Vista, Microsoft Windows XP SP2 et Windows Server 2003 SP1.

.NET Framework

Prise en charge dans : 3.0

Ajouts de la communauté

AJOUTER
Afficher:
© 2016 Microsoft