Skip to content

Commit 121dcf9

Browse files
authored
Updating variable and async call
updating variable with missing character ( '_') and adding GetAwaiter().GetResult() to the async call in the sync method
1 parent cf916d7 commit 121dcf9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

articles/azure-monitor/app/worker-service.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ Following is the code for `TimedHostedService` where the background task logic r
204204
{
205205
_logger.LogWarning("A sample warning message. By default, logs with severity Warning or higher is captured by Application Insights");
206206
_logger.LogInformation("Calling bing.com");
207-
var res = await httpClient.GetAsync("https://bing.com");
207+
var res = httpClient.GetAsync("https://bing.com").GetAwaiter().GetResult();
208208
_logger.LogInformation("Calling bing completed with status:" + res.StatusCode);
209-
telemetryClient.TrackEvent("Bing call event completed");
209+
_telemetryClient.TrackEvent("Bing call event completed");
210210
}
211211
}
212212
}

0 commit comments

Comments
 (0)