Azure App Insights-showing user count always 1 for .NET core web application

Venkata Ratnam Vemula 0 Reputation points
2024-04-09T01:28:30.73+00:00

I have ASP.NET Core web application hosted on 2 VMs in Azure behind a load balancer. I have configured the Application insights using the instrumentation key and modifying the code in Startup.cs, where I am able to see the activity logs, but the user count is always showing as 1 and not able to see live metrics.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,851 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Monalla-MSFT 12,041 Reputation points
    2024-04-09T14:42:07.07+00:00

    @Venkata Ratnam Vemula - Welcome to Microsoft Q&A and thanks for reaching out to us.

    1. Regarding the user count, it's possible that the user count is showing as 1 because you are the only user accessing the application. The user behavior analytics tools in Application Insights count users and sessions based on anonymous user IDs and session IDs. You can use ITelemetryInitializer interface to add custom properties and track more information about your users like IP addresses or user IDs.
      1. Regarding the live metrics, ensure that your Application Insights configuration is correct. It's possible that you need to enable Live Metrics in the Azure portal. Please look at this doc for more info on Live Metrics. Once Live Metrics is enabled, you should be able to see real-time telemetry data for your application. If you are still having trouble seeing live metrics, you can try the following troubleshooting steps:
    2. Make sure that your application is sending telemetry data to Application Insights. You can check this by going to the "Metrics Explorer" option in the left-hand menu and selecting the "Requests" metric. If you see data for this metric, it means that your application is sending telemetry data to Application Insights.
    3. Make sure that your application is running on a supported platform. Live Metrics is currently supported for ASP.NET, ASP.NET Core, Azure Functions, Java, and Node.js apps and you have the latest version of App Insights SDK.

    Hope this helps. and please feel free to reach out if you have any further questions.


    Please don't forget to "Accept as Answer" and click "Yes" if the above response if helpful, so it can be beneficial to the community.

    0 comments No comments