I want to collect exception's stack in application insights to debug it on local PC later.
I have a ASP.NET MVC 5.2 application with .NET 4.7.2 framework.
I added NuGet package Microsoft.ApplicationInsights.SnapshotCollector to my project, my app insights keys:
<Add Type="Microsoft.ApplicationInsights.SnapshotCollector.SnapshotCollectorTelemetryProcessor, Microsoft.ApplicationInsights.SnapshotCollector">
<!-- The default is true, but you can disable Snapshot Debugging by setting it to false -->
<IsEnabled>true</IsEnabled>
<!-- Snapshot Debugging is usually disabled in developer mode, but you can enable it by setting this to true. -->
<!-- DeveloperMode is a property on the active TelemetryChannel. -->
<IsEnabledInDeveloperMode>false</IsEnabledInDeveloperMode>
<!-- How many times we need to see an exception before we ask for snapshots. -->
<ThresholdForSnapshotting>1</ThresholdForSnapshotting>
<!-- The maximum number of snapshots we collect for a single problem. -->
<MaximumSnapshotsRequired>3</MaximumSnapshotsRequired>
<!-- The maximum number of problems that we can be tracking at any time. -->
<MaximumCollectionPlanSize>50</MaximumCollectionPlanSize>
<!-- How often to reset problem counters. -->
<ProblemCounterResetInterval>24:00:00</ProblemCounterResetInterval>
<!-- The maximum number of snapshots allowed per day. -->
<SnapshotsPerDayLimit>30</SnapshotsPerDayLimit>
<!--Whether or not to collect snapshot in low IO priority thread.-->
<SnapshotInLowPriorityThread>true</SnapshotInLowPriorityThread>
</Add>
(I follow the documentation: https://docs.microsoft.com/en-us/azure/application-insights/app-insights-snapshot-debugger )
I added this controller method to test:
public ActionResult TestCatchException()
{
try
{
throw new WebException("Test web ex");
}
catch(WebException web_ex)
{
try
{
throw new Exception("Web Catch First Level", web_ex);
}
catch(Exception ex)
{
var telemetry = new TelemetryClient();
telemetry.TrackException(ex);
}
}
return RedirectToAction("Error", new { Text = "err" });
}
then I look it on azure portal:
but no way to download exception snapshot. What is wrong?