Minor
4.6.2
Investigating
A deadlock may result in a Reentrant service, which restricts instances of the service to one thread of execution at a time. Services prone to encounter this problem will have the following xref:System.ServiceModel.ServiceBehaviorAttribute in their code:
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant)]- Quirked
- Build-time break
To address this issue, you can do the following:
-
Set the service's concurrency mode to xref:System.ServiceModel.ConcurrencyMode.Single?displayProperty=nameWithType or <System.ServiceModel.ConcurrencyMode.Multiple?displayProperty=nameWithType>. For example:
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single)]
-
Install the latest update to the .NET Framework 4.6.2, or upgrade to a later version of the .NET Framework. This disables the flow of the xref:System.Threading.ExecutionContext in xref:System.ServiceModel.OperationContext.Current?displayProperty=nameWithType. This behavior is configurable; it is equivalent to adding the following app setting to your configuration file:
<appSettings> <add key="Switch.System.ServiceModel.DisableOperationContextAsyncFlow" value="true" /> </appSettings>
The value of
Switch.System.ServiceModel.DisableOperationContextAsyncFlowshould never be set tofalsefor Rentrant services.
T:System.ServiceModel.ServiceBehaviorAttributeF:System.ServiceModel.ConcurrencyMode.Reentrant
Windows Communication Foundation (WCF)