首页 > 解决方案 > Azure Monitor / Application Insights 未显示错误堆栈跟踪

问题描述

我有一个托管在 Azure App Service 上的 ASP .Net Core 3.0 Web API。我试图弄清楚为什么它会在其中一种控制器操作方法中引发 500 Internal Server Error。我已经设置了 Application Insights,我可以在 Azure 门户的“失败”页面上看到有 500 个异常。但是,我看不到它们的堆栈跟踪。我需要做些什么才能在 Application Insights 或 Azure Monitor 中打开堆栈跟踪报告。PS 即使我的 API 在 .Net Core 2.2 上,它也没有显示堆栈跟踪,所以它不是 .Net Core 3.0 的东西。

这是一些屏幕截图:

在此处输入图像描述

在此处输入图像描述

标签: azureasp.net-core-mvcazure-application-insightsazure-monitoring

解决方案


在应用洞察查询窗口中,编写查询以显示异常并投影名为“详细信息”的属性。其中包含堆栈跟踪信息。

 exceptions
| where timestamp > ago(30d)
| order by timestamp asc
| project timestamp, message = iff(message != '', message, iff(innermostMessage != '', innermostMessage, customDimensions.['prop__{OriginalFormat}'])), details

推荐阅读