C# Azure Function 2.0不会为应用程序洞察提供例外情况
Azure Function 2.0不提供以下应用程序洞察的例外情况 我编写了以下方法来向app insights报告异常:C# Azure Function 2.0不会为应用程序洞察提供例外情况,c#,azure,asp.net-core,azure-functions,azure-application-insights,C#,Azure,Asp.net Core,Azure Functions,Azure Application Insights,Azure Function 2.0不提供以下应用程序洞察的例外情况 我编写了以下方法来向app insights报告异常: public void PublishOperationResult(Exception ex, string CustomMessage, Guid invocationId) { var _client = new TelemetryClient { InstrumentationKey = "my-key" };
public void PublishOperationResult(Exception ex, string CustomMessage, Guid invocationId)
{
var _client = new TelemetryClient
{
InstrumentationKey = "my-key"
};
_client.Context.Operation.Id = invocationId.ToString();
_client.Context.Operation.Name = "SnapshottingViewsException";
var exception = new ExceptionTelemetry(ex);
var properties = new Dictionary<string, string>
{
{"CustomMessage", CustomMessage}
};
foreach (var property in properties)
{
exception.Properties.Add(property);
}
_client.TrackException(exception);
}
如果禁用此功能并仅抛出异常,则一切都会按预期工作
版本:
Microsoft.NetCoreApp 2.1.0
Microsoft.SDK.Functions 1.0.29
Microsoft.ApplicationInsights.AspNetCore 2.7.1
算是解决了
我正在测试的异常来自一个SQL客户机。当抛出时,AppInsights将其视为异常,但当TelemetryClient报告时,它将被视为具有不同消息/标题的依赖项错误,我没有查找该消息/标题。因此更难发现
Microsoft.NetCoreApp 2.1.0
Microsoft.SDK.Functions 1.0.29
Microsoft.ApplicationInsights.AspNetCore 2.7.1