Search code examples
c#wcfduplex

WCF Duplex - How to find Client's Callback URL?


How to find the Client's Callback URL for a duplex HTTP binding, from within the service (WCF 3.5)?

Appreciate any help..


Solution

  • To get the callback to the client in a duplex channel what you do is within the method that was invoked on the service you would call

    OperationContext.Current.GetCallbackChannel<ICallbackContract>();
    

    where ICallbackContract is replaced with the actual callback contract name.

    Edit: Not sure what you mean by the phrase Clients Callback URL. If you mean the address of the client that could be obtained via:

    EndpointAddress clientAddress = OperationContext.Current.Channel.RemoteAddress;