예제 #1
0
        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();
            }
        }
예제 #2
0
 public async Task StartAsync(CancellationToken cancellationToken)
 {
     _webHost = WebHostFactory.BuildKestrelWebHost <DefaultWebStartup>(_webAppBuilderDelegate, _iocDelegate, _listenerInfo);
     await _webHost.StartAsync(cancellationToken);
 }