Robert.S

I have a full duplex WCF TCP Service. The client initializes the service passing the Instance Context for the service's Callback.

This works fine until I delegate tasks to worker threads in the service. Once a new thread is called the reference to OperationContext.Current is no longer available. I am storing off the OperationContext in a member hashtable for later use in responding to the request.

This seems to work fine but is there a better way of doing this


Re: Windows Communication Foundation (Indigo) Multhithreaded WCF Service Library

Christian Weyer

Yes, OperationContext.current is a ThreadStatic.

Wouldn't it suffice to store your 'subscribers' in an AppDomain static and eventually create a persistent backend for it

Can you elaborate a bit on why you pass the InstanceContext from the client to the service






Re: Windows Communication Foundation (Indigo) Multhithreaded WCF Service Library

Robert.S

I was referring to
// Create a client
CalculatorDuplexClient client = new CalculatorDuplexClient(instanceContext);

The 'subscriptions' do not need to be persisted on the backend really, they just need to know what OperationContext to use for their responses. I was wondering if just using some sort of collection, like a hashtable, is what is preferred.




Re: Windows Communication Foundation (Indigo) Multhithreaded WCF Service Library

Christian Weyer

OK, I usually just use a thread-safe AppDomain static - works fine for me.