1
嗨,ICommunicationObject.State不起作用?
创建我有DuplexChannelFactory WCF客户端,问题是,当我这样做:
((ICommunicationObject)this.GetMyServiceInterfaceChannel).State
我得到的跟随着例外:
无法获得域或致电方法在类型'System.ServiceModel.ICommunicationObject'的实例上,因为它是远程对象的代理。
为什么?
我需要检查通道是否有故障。
EDIT1:
ClientService clientService = new ClientService();
InstanceContext context = new InstanceContext(clientService);
DuplexChannelFactory<My.ServiceContracts.IMyClientService> factory = new DuplexChannelFactory<My.ServiceContracts.IMyClientService>(context, connectionName);
factory.Credentials.UserName.UserName = anvandarNamn;
factory.Credentials.UserName.Password = password;
return factory.CreateChannel();
使用IClentChannel时,我会得到完全相同的异常吗? – Banshee 2012-04-10 11:28:29
您可以添加'GetMyServiceInterfaceChannel'创建代码吗? – Fabske 2012-04-10 11:31:36
看看我的编辑。 – Banshee 2012-04-10 11:42:49