Application Insights beta-7不起作用

时间:2015-11-09 13:14:56

标签: azure azure-application-insights

我正在尝试在Azure中使用Application Insights。而我在例子中做了一切。但是当我试着打电话时

app.UseApplicationInsightsRequestTelemetry()
配置中的

我的网络应用程序停止工作。我尝试使用构造函数手动创建TelemetryClient,但

_telemetryClient.TrackException(ex);

什么也不做。

在我看来,注射有问题。我在玩Autofac并尝试注入它

_telemetryClient = app.ApplicationServices.GetService<TelemetryClient>();

但也没有帮助。

有什么问题吗?

2 个答案:

答案 0 :(得分:0)

您是否按照here

提及services.AddApplicationInsightsTelemetry(Configuration);

另请点击此issue

答案 1 :(得分:0)

正确的答案是我们需要获得正确的TelemetryClient对象。不知道为什么没有关于此的文档,但它应该看起来像:

app.UseExceptionHandler(errorApp =>
{
var telemetry = ServiceProviderExtensions.GetService<TelemetryClient>(errorApp.ApplicationServices);
}
相关问题