Add Application Insights automatically

This procedure configures your ASP.NET web app to send telemetry to the Application Insights feature of the Azure Monitor service. It works for ASP.NET apps that are hosted either in your own IIS servers on-premises or in the cloud.

Add Application Insights automatically

This section guides you through automatically adding Application Insights to a template-based ASP.NET web app. From within your ASP.NET web app project in Visual Studio:

1. Select Project > Add Application Insights Telemetry > Application Insights Sdk (local) > Next > Finish > Close.

2. Open the ApplicationInsights.config file.

3. Before the closing </ApplicationInsights> tag, add a line that contains the connection string for your Application Insights resource. Find your connection string on the overview pane of the newly created Application Insights resource.

Copy connection string from Application Insights Resource Overview

4. Select Project > Manage NuGet Packages > Updates. Then update each Microsoft.ApplicationInsights NuGet package to the latest stable release.

5. Run your application by selecting IIS Express. A basic ASP.NET app opens. As you browse through the pages on the site, telemetry is sent to Application Insights.

Post a Comment