【问题标题】:What are all the nuget Packages are required for Azure App InsightAzure App Insight 需要哪些 nuget 包
【发布时间】:2022-07-04 17:59:06
【问题描述】:

我正在构建一个 .Net Core 3.1 WebAPI,并将其部署在 Azure Web 服务上。我想启用 App Insight

目前我有以下nuget包

  <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>

但是,我认为,我只需要以下软件包

<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>

我如何知道支持 Azure App Insight 需要哪些软件包,哪些不是必需的?

【问题讨论】:

  • 根据the documentation,如果您尝试为 ASP .net 核心配置应用程序洞察力,您应该拥有Microsoft.ApplicationInsights.AspNetCore Nuget 包。

标签: azure .net-core .net-core-3.1 azure-log-analytics appinsights


【解决方案1】:

感谢@VenkateshDodda-MSFT 的评论

据此Document

  • 为了在 .NET 应用程序中使用 Application Insights 收集日志,我们需要添加以下 Nuget 包
 Microsoft.ApplicationInsights.AspNetCore
  • 添加Microsoft.ApplicationInsights.AspNetCore包后,默认添加以下包

  • Microsoft.ApplicationInsights.WorkerService nuget 包是为后台服务启用 Application Insights 所必需的

更多信息请参考What is created when you add Application Insights

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多