Exemple #1
0
        private void OnEndpointFound(System.ServiceModel.Discovery.EndpointDiscoveryMetadata obj)
        {
            try
            {
                var channelFactory = new DuplexChannelFactory <IDebugService>(this, NetworkingHelper.CreateTcpBinding());
                var debugService   = channelFactory.CreateChannel(obj.Address);
                var info           = debugService.Initialize();
                if (_connections.Add(info))
                {
                    _clients[debugService] = new ClientContext(debugService, info);
                    var communicationObject = (debugService as ICommunicationObject);
                    communicationObject.Faulted += OnEndpointLost;
                    communicationObject.Closed  += OnEndpointLost;
                }
                else
                {
                    debugService.Close();
                    (debugService as ICommunicationObject).Close();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);

                //Try restore connection
                _dynamicServiceResolver.Probe(_probeTimeout);
            }
        }
Exemple #2
0
 protected override IAsyncResult OnBeginOfflineAnnouncement(System.ServiceModel.Discovery.DiscoveryMessageSequence messageSequence, System.ServiceModel.Discovery.EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state)
 {
     return(base.OnBeginOfflineAnnouncement(messageSequence, endpointDiscoveryMetadata, callback, state));
 }