What does "OperationContext.Current.GetCallbackChannel" actually do?

What does OperationContext.Current.GetCallbackChannel do? How does he identify each customer?

I have a problem with my WCF service. If more than two users are connected to the service, all the “interesting changes” that I send from the service to the clients go to the second connected user.

For example, if A, B, C, D join a service, if I send changes to C and D via a callback, it goes to B.

Any ideas?

More details

Client: ASP.NET Web Application

Binding: netTCPBinding

Update1

Okie, I found the cause of the problem. I hosted the asp.net client in IIS. For example, the client URL is http: // url1 . If I open several instances of the page on another machine and join the service, the callback channel always points to the first instance of the page (I open the site from different computers). But if I host the asp.net client on different sites in IIS, the callback channels are unique. Any thoughts on this?

+7
c # callback wcf duplex
source share
2 answers

When a service receives a call, OperationContext.Current.GetCallbackChannel returns the channel only to that caller. It does not return the channel that all clients transmit.

From your question, perhaps you only save the callback that was received in the last call. In fact, you need to keep a list containing each instance of the unique callback that was retrieved. Each time a method is called, you add a callback instance to this list. When you want to broadcast, you need to iterate each item in the list and make the necessary call.

If your service uses Singleton instance mode, the implementation object can store a list of callback instances as a data item. If your device uses Client or SingleCall instance mode, then you may have a global object containing a list of callback instances.

+6
source share

You need to configure the service to create a separate thread for each session. Take a look at http://msdn.microsoft.com/en-us/library/cc681240.aspx

+1
source share

All Articles