You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Application Insights出现大量n/a关键跟踪消息求助

问题:Azure上.NET Core应用的Application Insights出现大量n/a关键跟踪消息

我有一个部署在Azure上的.NET Core Web应用,使用Application Insights进行日志记录。发现出现了异常数量的n/a关键跟踪消息,仅1分钟内就有约11000条。请问有人在Application Insights中遇到过这个问题吗?

Application Insights中n/a关键跟踪消息截图

使用的库

  • Microsoft.ApplicationInsights.AspNetCore Version=2.15.0
  • Microsoft.ApplicationInsights.DependencyCollector Version=2.15.0
  • Microsoft.ApplicationInsights.DiagnosticSourceListener Version=2.15.0
  • Microsoft.ApplicationInsights.EventSourceListener Version=2.15.0
  • Microsoft.ApplicationInsights.TraceListener Version=2.15.0
  • Microsoft.ApplicationInsights.WindowsServer Version=2.15.0
  • Microsoft.AspNetCore.Hosting Version=2.2.7

.NET运行时

netcoreapp3.1

Application Insights配置代码

public static IWebHostBuilder UseLoggingWithAppInsights(this IWebHostBuilder builder)
{
    builder.ConfigureServices((context, services) =>
    {
        services.AddApplicationInsightsTelemetry(applicationInsightsInstrumentKey);
    });

    var provider = services.BuildServiceProvider();
    IWebHostEnvironment host = provider.GetService<IWebHostEnvironment>();
    IHttpContextAccessor context = provider.GetService<IHttpContextAccessor>();

    TelemetryConfiguration.Active.EnableTelemetry(applicationInsightsInstrumentKey, appName, telemetryDetails, telemetrySettings, context, host);

    TelemetryConfiguration config = provider.GetService<TelemetryConfiguration>() ?? TelemetryConfiguration.CreateDefault();

    TelemetryConfiguration.Active.FireTraceToSeeIfActive();
    config.FireTraceToSeeIfActive();

    builder.ConfigureServices((context, services) =>
    {
        var instrumentationKey = context.Configuration.GetValue<string>("ApplicationInsights:InstrumentationKey");
        
        if (string.IsNullOrWhiteSpace(TelemetryConfiguration.Active.InstrumentationKey)
            || TelemetryConfiguration.Active.InstrumentationKey != instrumentationKey)
        {
            TelemetryConfiguration.Active.InstrumentationKey = instrumentationKey;
        }

        var provider = services.BuildServiceProvider();
        Util.StaticApplicationLogging.LoggerFactory = provider.GetRequiredService<ILoggerFactory>();
    });

    builder.ConfigureLogging((builderContext, loggingBuilder) =>
    {
        loggingBuilder.AddConfiguration(builderContext.Configuration.GetSection("Logging"));
    });

    return builder;
}

内容的提问来源于stack exchange,提问作者endlesscalm

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 09:22:21