public async Task OnExecute(IConsole console) { console.WriteLine("Starting Boost UI..."); var port = NetworkExtensions.GetAvailablePort(Port); if (port != Port) { console.WriteLine($"Port {Port} is allready in use.", ConsoleColor.Yellow); var useOther = Prompt.GetYesNo($"Start UI on port: {port}", true); if (useOther) { Port = port; } else { return; } } _webServer.LogLevel = LogLevel; var url = await _webServer.StartAsync(Port); if (!Debugger.IsAttached) { if (Path is { })
async Task IBackgroundService.Execute(CancellationToken cancellationToken) { await _WebServer.StartAsync(); await cancellationToken.AsTask(); await _WebServer.StopAsync(); }
public Task StartAsync() => _server.StartAsync(_handler);