예제 #1
0
 public override Task StopAsync(CancellationToken cancellationToken)
 {
     client.Dispose();
     wcfClient.Abort();
     _logger.LogInformation("The service has been stopped.");
     return(base.StopAsync(cancellationToken));
 }
예제 #2
0
        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;
            }
        }