How to use Azure Application Insights in ASP.Net Core

Take advantage of Application Insights to monitor performance and detect and diagnose performance issues in your web application

Azure Application Insights is an extensible application performance management (APM) service that can be used to monitor performance, detect anomalies, and diagnose performance issues for a web application in real time. If you are using .Net Core, you can use Application Insights on the multiple platforms that .Net Core supports (Windows, Linux, or Mac).

Note that you can use Application Insights for applications built in various technologies including .Net, JavaScript, Node.js, and Java as well as .Net Core. And you can use Application Insights for such applications whether or not they are hosted in the cloud. In this article we’ll examine how you can log data to Azure Application Insights in an ASP.Net Core application.

To work with the code examples illustrated in this article, you should have Visual Studio 2019 installed in your system. If you don’t already have a copy, you can download Visual Studio 2019 here.

You will also need an Azure account as we’ll be pushing the log messages to Application Insights in Azure. If you don’t have an Azure account, you can create a free Azure account here. In the sections that follow, we’ll examine how we can configure Application Insights as one of the sinks for the default logger in ASP.Net Core.

Create an ASP.Net Core API project

To continue reading this article register now