Wcf – How WsDualHttpBinding is doing to know about the callback channel

wcfwsdualhttpbinding

something seems very wierd to me, I have tried to look inside WCF with Reflector but forgive me it's too hard to understand :(.

When client A call a duplex service on server B with wsDualHttpBinding, I was thinking that client A include the client base address (the address of the callback) in the header of the request like this

<a:ReplyTo>http://client.foo/29293-3287-2387-3291</a:ReplyTo>

.

But
OperationContext.Current.IncomingMessageHeaders.ReplyTo
returns null…

How wsDualHttpBinding is doing to know the address of the client channel ????

Is there some black magic or something ?

Solution

This is the reliable session which is responsible to transport the replyTo address. We can verify this with these binding elements in a customBinding

<reliableSession/>
<compositeDuplex/>
<oneWay></oneWay>
<textMessageEncoding></textMessageEncoding>
<httpTransport/>

Remove the reliableSession and your service have not the callback channel anymore…

Best Answer

I think this information is passed via messages when establishing the session. If you use a tool like "fiddler" to watch all the http traffic, my hunch is you'll see it in an initial session setup message. No magic, the client has to tell the server 'where to call back'.

Related Topic