Eugene D. Gubenkov
Eugene D. Gubenkov

Reputation: 5357

Azure Application Insights and Web Site projects

Is it possible to add Application Insights to a Web Site project type?

In Visual Studio, the following context menu is available for Web Application projects but is missing for Web Site projects.

enter image description here

Upvotes: 2

Views: 716

Answers (2)

Eugene D. Gubenkov
Eugene D. Gubenkov

Reputation: 5357

Just want to share what I ended up with doing. First of all, it seems to work like a charm.

The Application Insight is implemented as an ASP.NET Module, so in order to hook it up for Web Site project you need to do the following:

  1. Add Microsoft.ApplicationInsights.Web NuGet package
  2. Register AI module in web.config

    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ApplicationInsightsWebTracking" />
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
    </modules>
    
  3. Make sure you have ApplicationInsights.config in Web Site base directory (along with web.config) - it defines which telemetry you going to be collecting

Upvotes: 2

Oleg Sych
Oleg Sych

Reputation: 6568

You should be able to instrument a Web Site project with Application Insights manually. Here are the instructions.

Upvotes: 2

Related Questions