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); } }