public WCFServiceClient(InstanceContext instanceContext, Binding binding, EndpointAddress remoteAddress) :
            base(instanceContext, binding, remoteAddress)
        {
            this.ID = RemoteSideIDType.Parse(Guid.NewGuid().ToString());

            ((ICommunicationObject)base.Channel).Closed  += new EventHandler(ClientServiceContractClient_StateChanged);
            ((ICommunicationObject)base.Channel).Closing += new EventHandler(ClientServiceContractClient_StateChanged);
            ((ICommunicationObject)base.Channel).Faulted += new EventHandler(ClientServiceContractClient_StateChanged);
            ((ICommunicationObject)base.Channel).Opened  += new EventHandler(ClientServiceContractClient_StateChanged);
            ((ICommunicationObject)base.Channel).Opening += new EventHandler(ClientServiceContractClient_StateChanged);
        }
Esempio n. 2
0
        public virtual void ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            try
            {
                reader.ReadStartElement();
                this.RemoteID = RemoteSideIDType.Parse(reader.ReadElementString("RemoteID"));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                throw;
            }
        }
Esempio n. 3
0
        public WCFServiceHost(IDIContainer diContainer, IRemoteSideCommunicationContract clientServiceContractInstance, Uri clientServiceAddress)
            : base(clientServiceContractInstance, clientServiceAddress)
        {
            this.ID          = RemoteSideIDType.Parse(Guid.NewGuid().ToString());
            this.diContainer = diContainer;
            this.clientServiceContractInstance = clientServiceContractInstance;
            cm = diContainer.GetLazyBoundInstance <IWCFConfigManager>();

            ApplyConfiguration();

            this.AddServiceEndpoint(
                ServiceMetadataBehavior.MexContractName,
                MetadataExchangeBindings.CreateMexTcpBinding(),
                String.Concat(new Uri(cm.Value.ClientServiceAddress).OriginalString, "/mex"));

            this.Closed  += new EventHandler(clientServiceHost_StateChanged);
            this.Closing += new EventHandler(clientServiceHost_StateChanged);
            this.Faulted += new EventHandler(clientServiceHost_StateChanged);
            this.Opened  += new EventHandler(clientServiceHost_StateChanged);
            this.Opening += new EventHandler(clientServiceHost_StateChanged);
        }