public override Task StopAsync(CancellationToken cancellationToken) { client.Dispose(); wcfClient.Abort(); _logger.LogInformation("The service has been stopped."); return(base.StopAsync(cancellationToken)); }
private void InvokeService(int delay) { this.Trace.Write(string.Format("Calling service on thread {0}", Thread.CurrentThread.ManagedThreadId)); var proxy = new TestServiceClient(); try { var result = proxy.DoWork(delay); proxy.Close(); this.Trace.Write(string.Format("Completed calling service on thread {0} delay {1}", Thread.CurrentThread.ManagedThreadId, result)); this.labelDelay.Text = result.ToString(); } catch (Exception) { proxy.Abort(); throw; } }