tags:

views:

35

answers:

2

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

Appreciate any help..

+1  A: 

You normally find it trough

OperationContext.Current.GetCallbackChannel<T>()

Where T is the type of the CallBack interface defined in the contract.

Philippe
thanks Phil.. I couldn't figure out how to get the client URI though.. see my comment above..
Bhuvan
+4  A: 

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;
Steve Ellinger
But that doesn't give me the URI of the client... Trying to find an alternate method of identifying client call back channels using URI. Original problem is posted at http://stackoverflow.com/questions/3839311/wcf-custombinding-duplex-binaryencoding-no-security-cannot-call-back
Bhuvan
See my edits, not sure if its any more of a help though
Steve Ellinger