protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); try { HttpClient client = new HttpClient(); client.BaseAddress = new Uri(EnvironmentVariable.Domain(_configuration)); HttpResponseMessage response = await client.GetAsync(EnvironmentVariable.ServiceUrl(_configuration)); _logger.LogInformation("Response: {statusCode}", response.StatusCode.ToString()); } catch (Exception ex) { _logger.LogInformation("Error When Call Service | Exception: " + ex.ToString()); } await Task.Delay(EnvironmentVariable.Interval(_configuration), stoppingToken); } }