Home > Blockchain >  Using Application Insights with On-Premise IIS Server
Using Application Insights with On-Premise IIS Server

Time:10-07

I am trying to debug a dotnet core 5 Blazor Server app which is eating up all the memory of the IIS Server when it is deployed to a local IIS Server.

However, it is not clear what is causing the memory leak.

As far as I have been able to figure out, installing Application Insights should create the logs needed to be able to determine what the issue is.

So I have added App Insights to the Project. When I run the project, I can then see App Insights Events being created in Visual Studio.

However, the issue occurs when the app is published to the Production IIS Server. I don't understand how to view the application insight data from the Prod Server. Are logs being generated?

I have tried to find data on this, but most of what I found is for Azure Application Insights. But the app is not running on Azure.

So how do I view the logs from the Prod Server? Or is there a better way to debug this issue?

CodePudding user response:

So I have added App Insights to the Project. When I run the project, I can then see App Insights Events being created in Visual Studio.

However, the issue occurs when the app is published to the Production IIS Server. I don't understand how to view the application insight data from the Prod Server. Are logs being generated?

Let me get this clear: you have created an Azure Application Insights resource. When your run the project using the debugger you can see telemetry being generated.

  • Is this correct?
  • How did you verify telemetry is being generated?

If it works locally it should work when deployed on IIS. Your application will generate telemetry that will be send to the Application Insights resource in de Azure Cloud. It does not matter whether you app is actually hosted on Azure or not in this scenario.

If you are not seeing telemetry make sure the instrumention key is correctly set in the production environment.

There are several ways to explore the telemetry send to Application Insights:

CodePudding user response:

After some study, I found the answer to this.

You can use Azure Application Insights to view data collected from an asp.net core app, no matter where the app is actually running. It can be running on-premise, or in the cloud.

The way this works is that in your app, you add a "Connection String" for application insights. The connection string is made available in the Application Insights resource that you create in Azure.

Then you add this connection string to your code in your app. The, when the app runs, whether in Visual Studio, or from a published location, the app send data up to the Azure Resource through an endpoint.

The connection string looks like this:

InstrumentationKey=000000-0000-0000-0000-000000000;IngestionEndpoint=https://eastus2-0.in.applicationinsights.azure.com/

Then you add code such as:

  var options = new ApplicationInsightsServiceOptions { ConnectionString = @"InstrumentationKey==000000-0000-0000-0000-000000000;IngestionEndpoint=https://eastus2-0.in.applicationinsights.azure.com/" };
        services.AddApplicationInsightsTelemetry(options: options);

There are a number of ways to actually add the connection string. See the docs here

You then log into Azure to view the data collected.

  • Related