File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
articles/azure-monitor/profiler Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ In this guide, you'll:
41
41
dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore
42
42
```
43
43
44
- 1 . In your preferred code editor, enable Application Insights and Profiler in ` Program.cs ` :
44
+ 1 . In your preferred code editor, enable Application Insights and Profiler in ` Program.cs ` for ` WebAPI ` :
45
45
46
46
``` csharp
47
47
// Add services to the container.
@@ -51,6 +51,26 @@ In this guide, you'll:
51
51
profilerSettings .Duration = TimeSpan .FromMinutes (1 );
52
52
});
53
53
```
54
+
55
+ You can also enable Application Insights and Profiler for `Worker`. Update the `Program.cs` file for the `Worker` with the following:
56
+
57
+ ```csharp
58
+ using ServiceProfilerInWorkerNet6;
59
+
60
+ IHost host = Host .CreateDefaultBuilder (args )
61
+ .ConfigureServices (services =>
62
+ {
63
+ services .AddApplicationInsightsTelemetryWorkerService ();
64
+ services .AddServiceProfiler ();
65
+
66
+ services .AddHostedService <Worker >();
67
+ })
68
+ .Build ();
69
+
70
+ await host .RunAsync ();
71
+ ```
72
+
73
+
54
74
1 . Save and commit your changes to the local repository :
55
75
56
76
```console
You can’t perform that action at this time.
0 commit comments