【发布时间】:2021-10-07 19:07:37
【问题描述】:
我的系统的一些常规设置:
- Windows x64
- .net 3.1
- AspNet.Core
- Serilog + AppInsights 编写器
最近,我们开始观察到许多如下所示的跟踪日志。我认为当我们尝试将日志写入 AppInsights 时出现问题。但是我们可以看到我们的日志。看来我们拥有正确登录 AppInsights 所需的一切。但是我们也登录了这个不需要的跟踪消息,而且数量很多。
此跟踪消息发生在我的本地计算机上,在我们的 Azure AKS 环境中。但是堆栈跟踪太短,无法帮助定位错误的根源。
AI (Internal): [Microsoft-ApplicationInsights-Core] [msg=Log Error];[msg=Exception while initializing Microsoft.ApplicationInsights.AspNetCore.TelemetryInitializers.ClientIpHeaderTelemetryInitializer, exception message - System.ObjectDisposedException: Request has finished and HttpContext disposed.
Object name: 'HttpContext'.
at Microsoft.AspNetCore.Http.DefaultHttpContext.ThrowContextDisposed()
at Microsoft.AspNetCore.Http.DefaultHttpContext.get_Features()
at Microsoft.ApplicationInsights.AspNetCore.TelemetryInitializers.TelemetryInitializerBase.Initialize(ITelemetry telemetry)
at Microsoft.ApplicationInsights.TelemetryClient.Initialize(ITelemetry telemetry)]
【问题讨论】: