You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/app/asp-net-core.md
+17-18Lines changed: 17 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,8 +44,7 @@ The [Application Insights SDK for ASP.NET Core](https://nuget.org/packages/Micro
44
44
***IDE**: Visual Studio, Visual Studio Code, or command line
45
45
46
46
> [!NOTE]
47
-
> - ASP.NET Core 6.0 requires [Application Insights 2.19.0](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.18.0) or later
48
-
> - ASP.NET Core 3.1 requires [Application Insights 2.8.0](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.8.0) or later
47
+
> - ASP.NET Core 6.0 requires [Application Insights 2.19.0](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.19.0) or later
49
48
50
49
## Prerequisites
51
50
@@ -86,7 +85,7 @@ For Visual Studio for Mac, use the [manual guidance](#enable-application-insight
86
85
87
86
2. Add `AddApplicationInsightsTelemetry()` to your `startup.cs` or `program.cs` class (depending on your .NET Core version)
88
87
89
-
### [ASP.NET Core 6.0](#tab/netcore6)
88
+
### [ASP.NET Core 6 and later](#tab/netcorenew)
90
89
91
90
Add `builder.Services.AddApplicationInsightsTelemetry();` after the `WebApplication.CreateBuilder()` method in your `Program` class, as in this example:
92
91
@@ -103,7 +102,7 @@ For Visual Studio for Mac, use the [manual guidance](#enable-application-insight
103
102
var app = builder.Build();
104
103
```
105
104
106
-
### [ASP.NET Core 3.1](#tab/netcore3)
105
+
### [ASP.NET Core 5 and earlier](#tab/netcoreold)
107
106
108
107
Add `services.AddApplicationInsightsTelemetry();` to the `ConfigureServices()` method in your `Startup` class, as in this example:
109
108
@@ -238,7 +237,7 @@ You can customize the Application Insights SDK for ASP.NET Core to change the de
238
237
239
238
You can modify a few common settings by passing `ApplicationInsightsServiceOptions` to `AddApplicationInsightsTelemetry`, as in this example:
@@ -320,7 +319,7 @@ When you want to enrich telemetry with additional information, use [telemetry in
320
319
321
320
Add any new `TelemetryInitializer` to the `DependencyInjection` container as shown in the following code. The SDK automatically picks up any `TelemetryInitializer` that's added to the `DependencyInjection` container.
322
321
323
-
### [ASP.NET Core 6.0](#tab/netcore6)
322
+
### [ASP.NET Core 6 and later](#tab/netcorenew)
324
323
325
324
```csharp
326
325
varbuilder=WebApplication.CreateBuilder(args);
@@ -333,7 +332,7 @@ var app = builder.Build();
333
332
> [!NOTE]
334
333
> `builder.Services.AddSingleton<ITelemetryInitializer, MyCustomTelemetryInitializer>();` works for simple initializers. For others, the following is required: `builder.Services.AddSingleton(new MyCustomTelemetryInitializer() { fieldName = "myfieldName" });`
@@ -351,7 +350,7 @@ public void ConfigureServices(IServiceCollection services)
351
350
352
351
By default, telemetry initializers are present. To remove all or specific telemetry initializers, use the following sample code *after* calling `AddApplicationInsightsTelemetry()`.
@@ -400,7 +399,7 @@ public void ConfigureServices(IServiceCollection services)
400
399
401
400
You can add custom telemetry processors to `TelemetryConfiguration` by using the extension method `AddApplicationInsightsTelemetryProcessor` on `IServiceCollection`. You use telemetry processors in [advanced filtering scenarios](./api-filtering-sampling.md#itelemetryprocessor-and-itelemetryinitializer). Use the following example.
@@ -447,7 +446,7 @@ By default, the following automatic-collection modules are enabled. These module
447
446
448
447
To configure any default `TelemetryModule`, use the extension method `ConfigureTelemetryModule<T>` on `IServiceCollection`, as shown in the following example.
@@ -564,7 +563,7 @@ public void ConfigureServices(IServiceCollection services)
564
563
565
564
If you want to disable telemetry conditionally and dynamically, you can resolve the `TelemetryConfiguration` instance with an ASP.NET Core dependency injection container anywhere in your code and set the `DisableTelemetry` flag on it.
566
565
567
-
### [ASP.NET Core 6.0](#tab/netcore6)
566
+
### [ASP.NET Core 6 and later](#tab/netcorenew)
568
567
569
568
```csharp
570
569
varbuilder=WebApplication.CreateBuilder(args);
@@ -577,7 +576,7 @@ builder.Services.Configure<TelemetryConfiguration>(x => x.DisableTelemetry = tru
0 commit comments