0

I am building a .Net Core 3.1 WebAPI and I would be deploying it on the Azure Web Service. I want to enable the App Insight

At present, I have the following nuget packages

  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.Agent.Intercept" Version="2.4.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.PerfCounterCollector" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.TraceListener" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.Web" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.WindowsServer" Version="2.20.0" />
    <PackageReference Include="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" Version="2.20.0" />
    <PackageReference Include="Microsoft.AspNet.TelemetryCorrelation" Version="1.0.8" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.5" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.5" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.20.0" />
    <PackageReference Include="Microsoft.Identity.Web" Version="1.1.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
  </ItemGroup>

However, I think, I just need the following packages

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.20.0" />
    <PackageReference Include="Microsoft.Identity.Web" Version="1.1.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.20.0" />
<PackageReference Include="Microsoft.ApplicationInsights.PerfCounterCollector" Version="2.20.0" />
  </ItemGroup>

How do I know what are all the packages are required to support Azure App Insight and what is not required?

One Developer
  • 99
  • 5
  • 43
  • 103
  • As per [the documentation](https://learn.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core) if you are trying to configure the application insights for the ASP .net core you should have `Microsoft.ApplicationInsights.AspNetCore` Nuget Package. – VenkateshDodda Jun 09 '22 at 03:45

1 Answers1

0

Thank you @VenkateshDodda-MSFT for the comment

As per this Document,

  • For collecting logs with Application Insights in .NET Applications , we need to add the below Nuget Package
 Microsoft.ApplicationInsights.AspNetCore
  • After adding the Microsoft.ApplicationInsights.AspNetCore package , the below packages are added by default

enter image description here

  • Microsoft.ApplicationInsights.WorkerService nuget package is required to enable Application Insights for background services

Please refer What is created when you add Application Insights for more information