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