One of my WCF service operation has transaction enabled-
[OperationBehavior(TransactionScopeRequired = true)]
public Car UpdateCar(Car c)
{
}
Earlier, I was running this service with InstanceContextMode as PerCall and ConcurrencyMode as Multiple which was getting me the below error-
An unhandled exception of type 'System.InvalidOperationException' occurred in System.ServiceModel.dll Additional information: The 'InventoryManager' service is configured with ReleaseServiceInstanceOnTransactionComplete set to true, but the ConcurrencyMode is not set to Single. The ReleaseServiceInstanceOnTransactionComplete requires the use of ConcurrencyMode.Single.
What I have tried:
In order to solve above error, i set 'ReleaseServiceInstanceOnTransactionComplete' to false and this did the trick.
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall
, ConcurrencyMode = ConcurrencyMode.Multiple
, ReleaseServiceInstanceOnTransactionComplete = false)]
Can someone please help to understand how disposing the service instance with 'PerCall' and 'Multiple' case solved this problem. What is the problem WCF thinks if I release service instance.