File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
articles/azure-monitor/app Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,7 @@ The full example is shared at this [GitHub page](https://github.com/microsoft/Ap
232
232
```csharp
233
233
using Microsoft.ApplicationInsights;
234
234
using Microsoft.ApplicationInsights.DataContracts;
235
+ using Microsoft.ApplicationInsights.WorkerService;
235
236
using Microsoft.Extensions.DependencyInjection;
236
237
using Microsoft.Extensions.Logging;
237
238
using System;
@@ -250,7 +251,7 @@ The full example is shared at this [GitHub page](https://github.com/microsoft/Ap
250
251
// Being a regular console app, there is no appsettings.json or configuration providers enabled by default.
251
252
// Hence instrumentation key/ connection string and any changes to default logging level must be specified here.
252
253
services.AddLogging(loggingBuilder => loggingBuilder.AddFilter<Microsoft .Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider>("Category", LogLevel.Information));
253
- services.AddApplicationInsightsTelemetryWorkerService(" instrumentation key here");
254
+ services.AddApplicationInsightsTelemetryWorkerService((ApplicationInsightsServiceOptions options) => options.ConnectionString = "InstrumentationKey=< instrumentation key here> ");
254
255
255
256
// To pass a connection string
256
257
// - aiserviceoptions must be created
You can’t perform that action at this time.
0 commit comments