Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
One of my WCF service operation has transaction enabled-
C#
[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.
C#
[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.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900