Search code examples
asp.netazureloggingweb-applicationsazure-application-insights

Application insights configuration in asp.net 4.8 web application


how can we configure application insights in asp.net 4.8 web application which has the entry point as global.asax.cs I need to pull out the logging in separate project and use Logger factor with Microsoft.Extensions.Logging


Solution

  • I hope you already created a 4.8 Web Application. Follow the workaround to add Application Insights in your Web Application Project.

    Workaround follows:

    Install the Application Insights Package Microsoft.ApplicationInsights in your application using NuGet Package Manager.

    enter image description here

    Configure Application insights in your Web Applicaiton:

    Right click of your project and click Configure Application Insights

    enter image description here

    It will ask you to choose Configure Application Insights either local or Azure. Choose as per your requirement.

    enter image description here

    It will configure your Web App into Application Insights. It adds the ApplicationInsights.config file which contains the configuration of Application Insights.

    enter image description here

    After the configuration done we can see the telemetry data in Application Insights

    Results

    enter image description here

    References:

    1. Using pageview to collect telemetry data in pages using Adding Instrumentation key in web.config
    2. Using Application Insights in global.aspx