Application Insights stop working after deployed to Azure - azure

I set up Application Insights on my asp.net core (2.2) app. I can see data in Azure portal when I run my application locally. However, once I deploy it to App Service in Azure, Application Insights stop working - there is no data flow at all. Are there any additional steps I am missing?

Adding to Stuart's comments- > If you edited ApplicationInsights.config, kindly check the configuration of TelemetryInitializers and TelemetryProcessors. An incorrectly-named type or parameter can cause the SDK to send no data.
Also, in the Application Insights portal, open Diagnostic Search. Data usually appears here first. Refresh to see if it helps.
If feasible, you may restart the app and check to see if that helps.

Related

How to view errors for WebApp in Azure portal and what configuration it is required

I am working on the ASP.Net MVC 4.8 application. It does have Logs file log4net and it was deployed in on-premises. Now it has been migrated to Azure. Now I am trying to find out some errors and other logs information however I am not able to find where to go and look for the logfile. I have two interest, 1 check the error messages and any log information.
If I need to make some changes what would be the easiest and straightforward way to capture logs and view them in Azure portal. As you can see in the picture below unter Monitoring there are many ways are given to see the logs but I am not sure where to go.
The app service will create an application insights of the same name.
This application Insights will contain all the logs regarding the web app along with performance data and other telemetry data too.
You can view logs live under live metrics tab in application insights of the same name as web app .
Here I have deployed a simple mvc app which logs using Ilogger (typical boilerplate app which visual studio provides ) . IT will log once I refresh the page.
Refer these MS DOCS on application insights

Using Application Insights with On-Premise IIS Server

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?
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:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/diagnostic-search
https://learn.microsoft.com/en-us/azure/azure-monitor/app/overview-dashboard
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/queries
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.

No data for my application insights live metrics with .NET Core 3.1

I'm trying to setup Application Insights on my ASP.NET Core 3.1 web application but without success...
I installed the version 2.16 of "Microsoft.ApplicationInsights.AspNetCore", then add the following line in the startup.cs file:
services.AddApplicationInsightsTelemetry(_configuration);
Moreover, I added the following section in the appSettings:
"ApplicationInsights": {
"InstrumentationKey": "XXX"
}
When I launch this with Visual Studio, I can see data in Live metrics, however, as soon as I deploy this in the production server with IIS, it just display that the application is off. I tried to put the connection string instead, without luck.
I'm suspecting a proxy issue, however, I have no way to be sure of this and it seems unlikely because I'm using the proxy as well on my local machine where it works.
I put the log level of the application on "Information" and I see nothing related to Application Inisights. I even tried to enable the developer mode, it didn't change anything.
The main issue is that I have no error anywhere, so I don't even know what to search :-)
I have encountered the same situation as you, but I'm not sure if we are facing the same error because of no error message.
I have my own ASP.NET Core 3.1 web application and I did the same configuration in my project, and when run it by vs in local environment, azure application insights can show live metrics, when have deployed in azure app service, it shows 'your app is offline'.
In my scenario, it's result from web app instance creation. When I creating an app service, it will create new application insights as default. Like the screenshot below, and of course the new one has different instrumentation key from the key in 'appSetting.json', it caused that when I look into application sights configured in the project, I can't see live metrics but I can see in the application sights that has the same name with app service.
And when creating app service with new application insights, the configuration tab in web app will display some keys like below, and they won't exist if didn't create new insights.
Upon this situation, I tried to modify these two keys with the value of insights that is used in project, and then live metrics worked.
Priority for obtaining the insights configuration may lead to my problem, because there are several ways to set connection.

Why Application insight is not working after doing slot swapping in azure app service?

I am using application insight for measuring performance and also storing some telemetry data of my web application and it was working fine till last month.
But from last month I am unable to see any traffic in app insight. In last month just I have added one slot in my app service. I have checked instrumentation key, it's same and correct and there is no change in application settings and configuration in app service.
Could you please suggest me if any additional settings I need to take care ?
I suspect this issue is due to adding of slot because in other environment it's working fine.
You could go to Visual Studio configure Application Insights through there and then redeploy the application to slot.
For more information, you could refer to this doc: Application Insights support for Multiple Environments, Stamps and App Versions, , specifically the 'Multi Stamp Support'.
How are you enabling application insights for the App in Azure Web App? Are you using extensions or do you take nuget dependency at build time?
If using extension, please navigate to this url to find the status of application insights enablement: https://yoursitename.scm.azurewebsites.net/ApplicationInsights
Have you ensured that that instrumentation key is available in all slots? This is most likely an instrumentation key issue.

No data on Application Insights

I have Application Insights SKD on a ASP.NET application, but i can't see data on Azure Portal, I have followed the official documentation for troubleshoot and the connectivity with dc.services.visualstudio.com seems to be fine but i can't connect to f5.services.visualstudio.com, but f5.services.visualstudio.com seems not used anymore, I can't access it inside and outside of my network.
The account have access to Performance Logs too, and I uninstalled the SCOM Monitoring Agent to prevent problems, but still no data!
Check that assemblies are included in your project
Check you have last SDK version of Application Insights installed
Check ApplicationInsights.config file exists in the root of application and instrumentation key is presented
If you resolve InstrumentationKey from web.config or from another place, debug your application and ensure the InstrumentationKey is really resolved
Check your telemetries are collecting using the Visual Studio Diagnostics Hub (developer mode must be set to TRUE - by default)
Try to send more telemetries or change the flush interval to 0
First place where you can check your telemetries is Azure Portal - Diagnostic Search blade
Try to check quotas on Azure Portal

Resources