I have a WCF that is used by a multi threaded client for processing the number of requests parallel. Somehow it starts sharing data of two different requests/threads; I have tried to change the InstanceContextMode
and ConcurrencyMode
as following:
- Default InstanceContextMode = PerSession ConcurrencyMode = Single
- InstanceContextMode = PerCall ConcurrencyMode = Single
- InstanceContextMode = PerCall ConcurrencyMode = Multiple
But there is no luck so far. There is no shared variables and functions which may cause of this concurrency issue. According to the MS documentation PerCall
creates instance for each single call and it doesn't make any sense that how data is shared between instances when they have their own private memory stack.
Workflow: There are three main components WCF, .Net Assembly 1 and .Net Assembly 2. There is a function named "Process" of WCF which takes a string parameter and returns the structured object based on the processing done through WCF. There is no instance variable in the WCF; everything in the function. This function does little processing on the string and convert it into the structured object then pass it to the function of Assembly 1 does some processing and then pass it to the function of Assembly 2 using the invoke method of reflection. This is the entire process which somehow mix the end result of two different concurrent calls.
I would be really thankful if anyone can help to figure this issue out.