Hi,
My WCF service provides multiple services from different end points. Currently my client app calls these methods independently as shown below:
object result1 = null;
object result2 = null;
using (OperationContextScope contextScope = new OperationContextScope((IContextChannel)ServiceInstance))
{
MyService.AddHeaders();
result1 = ServiceInstance.Method1()
}
//some other processing depending on the value of result1
using (OperationContextScope contextScope = new OperationContextScope((IContextChannel)ServiceInstance))
{
MyService.AddHeaders();
result2 = ServiceInstance.Method2()
}
Now, to improve performance, I tried doing the following:
using (OperationContextScope contextScope = new OperationContextScope((IContextChannel)ServiceInstance))
{
MyService.AddHeaders();
result1 = ServiceInstance.Method1()
result2 = ServiceInstance.Method2()
}
//some other processing depending on the value of result1 && result2
But this is failing with the error: "disposed object can't be used" and in the inner exception the disposed object is ChannelService.
Can someone help me how can I combine multiple WCF service calls under one OperationContextScope?
Thanks Aravind