我有一个托管在 Azure 应用服务上的 ASP .Net Core 3.0 Web API。 我试图找出为什么它在 Controller 操作方法之一中抛出 500 内部服务器错误。 我已经设置了 Application Insights,并且可以在 Azure 门户上的“失败”页面上看到有多个 500 异常。但是,我看不到它们的堆栈跟踪。我需要做什么才能在 Application Insights 或 Azure Monitor 中打开堆栈跟踪报告。 附:即使我的 API 在 .Net Core 2.2 上,它也没有显示堆栈跟踪,因此它不是 .Net Core 3.0 的东西。
以下是一些屏幕截图:
最佳答案
在应用洞察查询窗口中,编写一个查询来显示异常并投影名为“详细信息”的属性。其中包含堆栈跟踪信息。
exceptions
| where timestamp > ago(30d)
| order by timestamp asc
| project timestamp, message = iff(message != '', message, iff(innermostMessage != '', innermostMessage, customDimensions.['prop__{OriginalFormat}'])), details
关于Azure Monitor/Application Insights 不显示错误的堆栈跟踪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58376320/