Configure Your Web Application To Use Application Insight

Introduction

Are you starting a new project or have an existing Web Application and want to use Application Insights? In this regard, it's better to use Visual Studio, and Visual Studio 2013 now comes with built-in capability to add Application Insights to your application.

Follow the steps shown below in order to add Application Insight in a new ASP .NET application:

Step 1: Open Visual Studio and click on File, then New Project.

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



Step 3: The right panel of this window gives you details of the project and the 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.



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

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

Select “Webforms” and click “OK”.



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

Run the project by pressing “Control+F5” on Visual Studio project.

Switch back to Visual Studio and you will observe the Application that has already started sending data to Application Insights:





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

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

Step 4: 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:



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


Similar Articles