namespace tias.deep.CMS; public class Worker : BackgroundService { private tias.deep.server.core.Init _server; public Worker() { this._server = new tias.deep.server.core.Init(); } public override Task StartAsync(CancellationToken cancellationToken) { _server.StartServer(false); return base.StartAsync(cancellationToken); } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { await Task.Delay(1000, stoppingToken); } } public override Task StopAsync(CancellationToken cancellationToken) { _server.StopServer(); return base.StopAsync(cancellationToken); } }