Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.Net Core - Application Insights - Stack Trace

I'm setting up a pretty simple ASP.Net Core (2.2) MVC Web App. I want to be able to see any application errors (500s) and what caused them so it seems like Application Insights is the place to look.

If I go into Application Insights / Failures (Operations Tab - see screenshot below), I'm able to see a graph/count of all the 500 errors. I can click on "DRILL INTO" button and see a lof of the details (Event Time, Request Name, etc...) but cannot seem to get any details on the actual cause of the error / line number.

failures

Basically, I have the exact same problem as this person: Azure Monitor / Application Insights not showing stack trace for errors (my screenshots look identical).

When I drill down to the exception details, I get something like this:

myexception

I'm want to get something like this:

Exception Section

I did see info on adding Application Insights via Nuget to my solution and putting

 services.AddApplicationInsightsTelemetry();

into the Startup/ConfigureServices method.

I also see that you can look at Kudu logs, etc... but I really want this all to be easily accessible in Application Insights.

Any suggestions?

like image 917
Mike Smith Avatar asked Jan 27 '26 19:01

Mike Smith


1 Answers

OK - I think I solved my own problem. Turns out I had added Serilog a while back (sort of forgot about that) and it was capturing all the errors before getting to AI. When I removed the Serilog configuration code from Program.cs and Startup.cs, the application exceptions started showing up in Application Insights / Failures along with the full Call Stack. Thanks for your suggestions!

like image 53
Mike Smith Avatar answered Jan 29 '26 11:01

Mike Smith



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!