public void Connect() { if (_proxy == null || (_proxy != null && (_proxy.Channel.State == CommunicationState.Closed || _proxy.Channel.State == CommunicationState.Faulted))) { if (_proxy != null) { _proxy.Dispose(); } _proxy = _infoServiceType.CreateProxy(_server); _proxy.OperationTimeout = TimeSpan.FromMinutes(Settings.Default.OperationTimeout); _proxy.ChannelFactory.Endpoint.Behaviors.Add(new LogHeaderReaderBehavior()); _proxy.Open(); } Connection = new InformationServiceConnection((IInformationService)_proxy); Connection.Open(); if (Settings.Default.UseActiveSubscriber && _infoServiceType.SupportsActiveSubscriber) { _notificationDeliveryServiceProxy = _infoServiceType.CreateNotificationDeliveryServiceProxy(_server, NotificationSubscriber); _notificationDeliveryServiceProxy.Open(); _activeSubscriberAddress = string.Format("active://{0}/SolarWinds/SwqlStudio/{1}", Utility.GetFqdn(), Process.GetCurrentProcess().Id); _notificationDeliveryServiceProxy.ReceiveIndications(_activeSubscriberAddress); _activeSubscriberInfo = new SubscriberInfo() { EndpointAddress = _activeSubscriberAddress, OpenedSuccessfully = true, DataFormat = "Xml" }; } }
internal NotificationDeliveryServiceProxy CreateActiveListenerProxy(INotificationSubscriber listener) { if (!_infoServiceType.SupportsActiveSubscriber) { throw new InvalidOperationException("This connection type doesn't support active subscriptions"); } return(_infoServiceType.CreateNotificationDeliveryServiceProxy(_server, listener)); }