protected override void OnAfterStart() { try { _address = Constants.BaseAddress + Pid; var binding = WcfUtils.GetNetNamedPipeBinding(); var ep = new EndpointAddress(_address); var type = typeof(IRemoteVstService); var proxyCreatorType = MakeGenericType(type); var proxyCreator = GetProxyCreator(proxyCreatorType, binding, ep); var x = _generator.CreateInterfaceProxyWithoutTarget(type, new[] { typeof(IContextChannel) }, CreateInterceptor(proxyCreator, type)); _vstService = x as IRemoteVstService; _vstService.Ping(); _vstServiceAvailable = true; IsBusy = false; _pingTimer.Start(); } catch (Exception ex) { ForceStop($"Failure when attempting to open the service channel: {ex}"); } }
private void PingTimerOnElapsed(object sender, ElapsedEventArgs e) { if (inShutdown || CurrentProcessState == ProcessState.EXITED) { return; } try { _vstService.Ping(); _pingTimer.Start(); } catch (Exception ex) { Log(ex.Message); Log(ex.StackTrace); ForceStop($"Ping failed: {ex}"); } }