Configure Your Web Application To Use Application Insight

Introduction

This article will guide you to configure your web application, to use Application Insights on Azure. If you are starting a new project or have an existing Web application and want to use Application Insights, then Visual Studio 2013 and later now has a built-in capability to add Application Insights to your application.

Link

  • Click here for Kick-start to Application Insights on Microsoft Azure.
  • Click here for creating an Application Insight on Microsoft Azure.

Pre-requisites

  1. Microsoft Azure account. - Click here to get a free Microsoft Azure account (this will be a temporary one).
  2. Visual Studio 2015. – Click here to download Visual Studio 2015.

Follow the below steps now.

Step 1

Open Visual Studio and click on File->New Project.

Step 2

  1. In the “New Project” window, select “Cloud” in the left panel and then “ASP.NET Web Application” middle panel.

    Project

Step 3

The right panel of this window gives you details of the project and option of adding “Application Insights” to the project. Select the checkbox “Add Application Insight to Project”. If you are not already logged-in, Visual Studio will prompt you to sign-up with the Microsoft Account provided to you.

Project

Step 4

After signing up, you can select the Drop-Down to use an existing “Application Insight” resource or a new one with same as “Project Name”.

Step 5

Click on OK and you will get option to select the “Template” of the ASP.NET Web application project.

Step 6

Select “Webforms” and click “OK”.

Project

Step 7

Once created, you will see the ASP.NET Web application created with default template.

Step 8

Run the project by pressing “Control+F5” on visual studio project.

Step 9

Switch back to Visual Studio and you will observe the application has already started sending data to “Application Insights".



Project

Step 10

Refresh the page opened for this project in the browser and observe the count increasing in the “Application Insights” tab.

Step 11

Now, “Stop” the project from Visual Studio and open the Solution Explorer.

Step 12

In the Solution Explorer, you will find “Overview” for your “Application Insights” resource that you have selected for your project under the “ApplicationInsights.config” file. Double click on that link.

Project

Step 13

This will pop-up a new browser window and will take you directly to the “Application Insight Resource” in Microsoft Azure portal.

Project