tralala

Hello everybody,

I tried to access OperationContext.Current from withing a local service but unfortunately it was null.

It is only null in the local service.

I suppose it has to do with the thread model.

How can I let WF run in the WCF thread

Or any other solution

Thanks in advance,

Philippe




Re: Windows Workflow Foundation WCF OperationContext & ExternalDataExchange service

Roman Kiss

Philippe,

- have a look at this thread

Thanks

Roman






Re: Windows Workflow Foundation WCF OperationContext & ExternalDataExchange service

Tom Lake - MSFT

It doesn't sound like you are using Orcas, which has a bug related to this that was fixed after Beta 2. In order for OperationContext.Current to be set properly you need to create an OperationContextScope.






Re: Windows Workflow Foundation WCF OperationContext & ExternalDataExchange service

tralala

Hello,

Thanks for your help.

Which constructor for OperationContextScope do I need to use because my OperationContext.Current is null.






Re: Windows Workflow Foundation WCF OperationContext & ExternalDataExchange service

Roman Kiss

- try the following:

Code Block

using(OperationContextScope scope =

new OperationContextScope((IContextChannel)channel))

{

// ...

}

Thanks

Roman






Re: Windows Workflow Foundation WCF OperationContext & ExternalDataExchange service

Tom Lake - MSFT

Did you use one of the constructors and OperationContext.Current is still null Either constructor should be fine.






Re: Windows Workflow Foundation WCF OperationContext & ExternalDataExchange service

Dinesh Ravva - MSFT

Is your local service executed with in the service method call invoked by client You would be able to access operationcontext.current only in the context of the method call.

Suppose if you have a code activity inside the receive, you would be able to access the operationcontext.current inside this code activity when a client calls method corresponding to the receive activity.

Dinesh.