R – WCF callback interface passing to another WCF service method on different machine

callbacknetPROXYwcf

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)

Best Answer

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.

Related Topic