protected override async Task ExecuteAsync(CancellationToken stoppingToken) { try { _webHost = WebHostFactory.BuildKestrelWebHost <DefaultWebStartup>(_webAppBuilderDelegate, _iocDelegate, _listenerInfo); await _webHost.StartAsync(stoppingToken); while (!stoppingToken.IsCancellationRequested) { await _workerProcess(stoppingToken); } await _webHost.StopAsync(stoppingToken); } finally { _webHost?.Dispose(); } }
public async Task StartAsync(CancellationToken cancellationToken) { _webHost = WebHostFactory.BuildKestrelWebHost <DefaultWebStartup>(_webAppBuilderDelegate, _iocDelegate, _listenerInfo); await _webHost.StartAsync(cancellationToken); }