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
1. Enable Application Insights and Profiler in `Startup.cs`:
71
+
1. Enable Application Insights and Profiler:
72
+
73
+
### [ASP.NET Core 6 and later](#tab/net-core-new)
74
+
75
+
Add `builder.Services.AddApplicationInsightsTelemetry()` and `builder.Services.AddServiceProfiler()` after the `WebApplication.CreateBuilder()` method in `Program.cs`:
76
+
77
+
```csharp
78
+
var builder = WebApplication.CreateBuilder(args);
72
79
73
-
```csharp
74
-
public void ConfigureServices(IServiceCollection services)
75
-
{
76
-
services.AddApplicationInsightsTelemetry(); // Add this line of code to enable Application Insights.
77
-
services.AddServiceProfiler(); // Add this line of code to Enable Profiler
78
-
services.AddControllersWithViews();
79
-
}
80
-
```
80
+
builder.Services.AddApplicationInsightsTelemetry(); // Add this line of code to enable Application Insights.
81
+
builder.Services.AddServiceProfiler(); // Add this line of code to enable Profiler
82
+
builder.Services.AddControllersWithViews();
83
+
84
+
var app = builder.Build();
85
+
```
86
+
87
+
### [ASP.NET Core 5 and earlier](#tab/net-core-old)
88
+
89
+
Add `services.AddApplicationInsightsTelemetry()` and `services.AddServiceProfiler()` to the `ConfigureServices()` method in `Startup.cs`:
90
+
91
+
```csharp
92
+
public void ConfigureServices(IServiceCollection services)
93
+
{
94
+
services.AddApplicationInsightsTelemetry(); // Add this line of code to enable Application Insights.
95
+
services.AddServiceProfiler(); // Add this line of code to enable Profiler
96
+
services.AddControllersWithViews();
97
+
}
98
+
```
99
+
100
+
---
81
101
82
102
## Pull the latest ASP.NET Core build/runtime images
0 commit comments