InstanceContextMode.Single + OperationContext.Current

S

sandrofurlan

Hi all,
i have a WCF service for USB communication. I need to instance it as a
singleton class so i do:

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.Single, _
ConcurrencyMode:=ConcurrencyMode.Multiple)> _
Public Class myService

....

End class

And that's OK! But I also need do define callbacks to signal events so
I add a callback Interface and:

<ServiceContract(NameSpace:="http://Microsoft.Services", _
SessionMode:=SessionMode.Required, _
CallbackContract:=GetType(ImyCallback))> _
Public Interface IService

...

end Interface

The problem is in the constructor method of Service'class where I've
to get the InstanceContext for the CallbackChannel. I got an exception
in this code:

public sub new

callback = OperationContext.Current.GetCallbackChannel(Of
IEasyBusCallback)() '<-Reference to an object not set up on an object
request

end sub

Note that class myService inherits another class that implements
communication

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top