views:

457

answers:

2

Hi,

I received callback interface from machine A and stored it on machine B.

I'd like to pass this callback interface (that is a proxy on machine B) to machine C.

Machines A, B and C uses WCF so proper interfaces are available.

The issue is when I run PassCallbackToDedicatedMachine(someCallback) method I receive exception like below:

Unable to cast object of type 'System.Object' to type 'HCP.Common.IClientApplicationCallback'.

When I run method on a callback proxy on Machine B everything is ok.

The problem is when I try to pass this callback (assigned to some WCF interface of course) to another machine.

Maybe there is some method to obtain client endpoint address from proxy, pass this address as string and manually instantiate it on different machine (that knows this interface also).

How to do it?

Thanks,

The callstack is below (maybe it will be helpful):

at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)

at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)

at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

A: 

I do not think that the way you are trying to do it will work.

You need to create a new callback on machine B, which you pass to machine C. On the way back the call will go via machine B.

Shiraz Bhaiji
I resolved the problem introducing additional method named SendCallbackTo() that sends callback interface directly to the proper destination. It involves additional calls between server center and client machine but it's simplest solution I found up to today.I have seen that in the proxy such information like endpoind url is available (in soap it's ReplyTo element). I have callback endpoint configuration and behaviour available on all server machines so in teory (for http) I should have the possiblity to create proxy manualy with specific destination.
Alex Stankiewicz
Different situation is with nettcp bindind of course because it's two way (directly) connection between machines that is pernament.
Alex Stankiewicz
A: 

Sorry you are not using DCOM anymore....

DCOM did deep magic to enable this type of thing, WCF is a lot closer to raw networking and does not hide the network from you to the same extent.

In real life DCOM was very hard to setup with security for this type of setup anyway.

Ian Ringrose