【问题标题】:Application Insights beta-7 does not workApplication Insights beta-7 不起作用
【发布时间】:2016-04-12 20:33:07
【问题描述】:

我正在尝试在 Azure 中使用 Application Insights。我做的一切都像例子中一样。但是,当我尝试打电话时

app.UseApplicationInsightsRequestTelemetry()

在配置中我的网络应用停止工作。我尝试使用构造函数手动创建 TelemetryClient,但是

_telemetryClient.TrackException(ex);

什么都不做。

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

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

但也无济于事。

有什么想法有什么问题吗?

【问题讨论】:

  • 有什么例外吗?您需要澄清“我的网络应用停止工作”的含义。可能存在很多问题,因此我们需要更多信息来为您缩小范围。

标签: azure azure-application-insights


【解决方案1】:

你有没有像提到的here那样打电话给services.AddApplicationInsightsTelemetry(Configuration);

也请 +1 这个issue

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-17
      • 2021-02-27
      • 2021-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多