skip to Main Content

Hello Stack Overflow community,

I’m facing an issue with Application Insights telemetry in my MVC 4 application when it’s deployed behind a private load balancer. Locally, the CPU and Memory telemetry is successfully pushed, but when running from a Virtual Machine behind a private load balancer, it shows "NA" as seen in the screenshot below:

enter image description here

Initially, I suspected the load balancer, but ongoing requests are indeed being pushed from the VM.

Here’s how I’ve configured Application Insights in my Startup.cs:

[assembly: OwinStartup(typeof(DesignHub.WebMvc.Startup))]
public class Startup
{ 
    public void Configuration(IAppBuilder app)
    {
        string appInsightsConnectionString = ConfigurationManager.AppSettings["AppInsightsConnectionString"];

        Configure Application Insights
        if (string.IsNullOrEmpty(appInsightsConnectionString) == false)
        {
            TelemetryConfiguration.Active.ConnectionString = appInsightsConnectionString;
        }
    }
}

I’d greatly appreciate any insights or suggestions on what might be causing this discrepancy and how to resolve it.

Thank you for your assistance!

2

Answers


  1. Chosen as BEST ANSWER

    The core issue lies in the IIS Application Pool's identity lacking sufficient permissions to access performance counters, impeding proper monitoring and resource analysis.

    Resolution Steps:

    Verify Application Pool Identity:

    • Open the Internet Information Services (IIS) Manager.
    • Navigate to Application Pools.
    • Double-click the relevant Application Pool.
    • In the Identity section, note the current user or service account under which the pool is running.

    Grant Permissions:

    • Open an elevated Command Prompt window (Run as administrator).

    • Execute the following command, replacing PoolName with the actual name of your Application Pool:

    net localgroup "Performance Monitor Users" /add "IIS APPPOOLPoolName"
    
    • Press Enter to execute the command. This grants the Application Pool's identity membership in the "Performance Monitor Users" group, enabling access to performance counters.

    Validate the Fix:

    • Restart the Application Pool (right-click on the pool in IIS Manager and select "Restart").

    • Attempt to access or collect performance counters after the restart. Confirm that the issue is resolved.


  2. Looks like you need to give permissions to read computer-level performance counter values.

    I suggest you give the following troubleshoot guide a try:

    https://learn.microsoft.com/en-us/troubleshoot/azure/azure-monitor/app-insights/missing-cpu-total-committed-memory-metrics

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search