【发布时间】:2010-12-01 10:22:49
【问题描述】:
收到A机器的回调接口,保存在B机器上。
我想将此回调接口(即机器 B 上的代理)传递给机器 C。
机器 A、B 和 C 使用 WCF,因此可以使用适当的接口。
问题是当我运行 PassCallbackToDedicatedMachine(someCallback) 方法时,我收到如下异常:
无法将“System.Object”类型的对象转换为“HCP.Common.IClientApplicationCallback”类型。
当我在机器 B 上的回调代理上运行方法时,一切正常。
问题是当我尝试将此回调(当然分配给某些 WCF 接口)传递给另一台机器时。
也许有一些方法可以从代理获取客户端端点地址,将该地址作为字符串传递并在不同的机器上手动实例化它(也知道这个接口)。
怎么做?
谢谢,
调用堆栈如下(也许会有所帮助):
在 System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(消息回复、MessageFault 故障、字符串操作、MessageVersion 版本、FaultConverter faultConverter)
在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime 操作)
在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 消息)
【问题讨论】: