Soru

Zorluk: KolayConfigure Application Insights Instrumentation and Telemetry

You are deploying a C# ASP.NET Core web application to an Azure App Service. In the Program.cs file, you register the telemetry services using builder.Services.AddApplicationInsightsTelemetry(). After deploying and running the application, you observe that no telemetry data is displayed in your Application Insights resource in the Azure portal. Which of the following configuration issues is the most likely cause of this behavior?

  1. The Application Insights connection string was not defined in the application settings or environment variables.Cevap
  2. B
    The Azure App Service was not granted GET permissions to the Key Vault containing the Application Insights resource credentials.
  3. C
    The App Configuration store contains an invalid URI reference for the Application Insights endpoint.
  4. D
    The App Service autoscale rules are misconfigured with conflicting scale-out and scale-in thresholds.

Cevap

The Application Insights connection string was not defined in the application settings or environment variables.
The correct answer is correct because the Application Insights SDK needs to know where to send the collected telemetry. When builder.Services.AddApplicationInsightsTelemetry() is called, the SDK initializes. However, if the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable or configuration value is not set, no telemetry data will be sent to the Azure Monitor service.

Adım Adım Çözüm

1
Verify that builder.Services.AddApplicationInsightsTelemetry() is correctly executed during application startup.
The telemetry collection services are registered in the DI container.
Ensures the SDK is active and listening to application events.
2
Check the environment variables of the hosting environment for the connection string configuration.
The APPLICATIONINSIGHTS_CONNECTION_STRING variable is missing or empty.
The SDK needs this value to know where to transmit the collected telemetry data.

Anahtar Kavram

Application Insights SDK requires a valid Connection String to send telemetry data to the correct Azure resource.
Bu soruyu puanla