[英]How to track down AppInsights internal error
我的系統的一些常規設置:
最近,我們開始觀察到許多如下所示的跟蹤日志。 當我們嘗試將日志寫入 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)]
我嘗試創建一個環境,其中包含 Asp.net 核心應用程序和 .net3.1,用於跟蹤日志(請求、異常、用戶、故障、跟蹤等)
以下是我遵循的步驟: 將應用程序洞察遙測添加到我的應用程序並安裝 NuGet package Microsoft.ApplicationInsights.AspNetcore
並在services.AddControllersWithViews();
下的startup.cs
中; 添加
services.AddApplicationInsightsTelemetry(Configuration["APPINSIGHTS_CONNECTIONSTRING"]);
將應用程序部署到 azure 並將日志 go 跟蹤到我創建的應用程序洞察> 事務搜索> 查看數據后,我們可以在其中看到我們所有的日志,如下所示,以確定是否有任何錯誤發生。
我們還可以下載所有日志並使用 kudu-console 追蹤應用程序。 Go 到 App service>Advance tools>Go
有關更多信息,請參閱以下鏈接:
. 醫學博士 | 在 Application Insights 中探索 .NET/.NET Core 和 Python 跟蹤日志
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.