private static async Task RunServiceAsync(Uri address, CancellationToken token) { CalculatorServiceHost host = new CalculatorServiceHost(TimeSpan.FromMilliseconds(100.0d), new NetNamedPipeBinding(NetNamedPipeSecurityMode.None), address); await host.OpenAsync(); while (!token.IsCancellationRequested) { try { await Task.Delay(TimeSpan.FromSeconds(5.0d), token); await host.RecycleAsync(); } catch (OperationCanceledException) { } } await host.CloseAsync(); }