Skip to content

Commit 2dc8869

Browse files
authored
Enhance troubleshooting for auto-instrumentation failures
Added troubleshooting information for ASP.NET Core auto-instrumentation issues related to overridden hosting startup assemblies.
1 parent cde4223 commit 2dc8869

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

support/azure/azure-monitor/app-insights/telemetry/auto-instrumentation-troubleshoot.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ To determine whether your version is supported, see the following .NET or .NET C
3434
- [Application monitoring for Azure App Service and ASP.NET](/azure/azure-monitor/app/azure-web-apps-net#application-monitoring-for-azure-app-service-and-aspnet)
3535
- [Application monitoring for Azure App Service and ASP.NET Core](/azure/azure-monitor/app/azure-web-apps-net-core#application-monitoring-for-azure-app-service-and-aspnet-core)
3636

37+
### Auto‑instrumentation fails when .NET Core Hosting Startup assemblies are overridden
38+
ASP.NET Core auto‑instrumentation on Azure App Service uses the ASPNETCORE_HOSTINGSTARTUPASSEMBLIES mechanism to load the Application Insights startup bootstrapper at runtime. If an application explicitly configures hosting startup assemblies (for example, via WebHostDefaults.HostingStartupAssembliesKey), that configuration overrides the App Service environment settings.
39+
40+
When this occurs and Microsoft.ApplicationInsights.StartupBootstrapper is not included, the Application Insights agent cannot attach and telemetry will not be collected, even though Application Insights appears enabled in the Azure portal.
41+
42+
To resolve this, remove custom hosting startup configuration or ensure Microsoft.ApplicationInsights.StartupBootstrapper is explicitly included in the configured hosting startup assemblies. If you intend to control startup assemblies programmatically, note that host configuration takes precedence over the ASPNETCORE_HOSTINGSTARTUPASSEMBLIES environment variable, then follow the sample shown in the public docs [here](https://learn.microsoft.com/aspnet/core/fundamentals/host/platform-specific-configuration?view=aspnetcore-8.0#specify-the-hosting-startup-assembly).
43+
3744
### A diagnostics library is detected
3845

3946
Autoinstrumentation fails if it detects the following libraries:

0 commit comments

Comments
 (0)