如何在Asp.Net Core项目中使用Application Insights启用依赖项跟踪 [英] How to enable dependency tracking with Application Insights in an Asp.Net Core project

查看:324
本文介绍了如何在Asp.Net Core项目中使用Application Insights启用依赖项跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的目标是netcoreapp1.1,并引用了版本2.1.0-beta1(当前最新)的nuget包Microsoft.ApplicationInsights.AspNetCore.

We are targeting netcoreapp1.1 and have referenced nuget package Microsoft.ApplicationInsights.AspNetCore with version 2.1.0-beta1 (currently the newest).

在program.cs中,我们具有.UseApplicationInsights();在Startup.cs:ConfigureServices中,我们具有services.AddApplicationInsightsTelemetry(this.Configuration);.

In program.cs we have .UseApplicationInsights() and in Startup.cs:ConfigureServices we have services.AddApplicationInsightsTelemetry(this.Configuration);.

我们已经尝试添加new DependencyTrackingTelemetryModule().Initialize(TelemetryConfiguration.Active);,但是在应用程序映射或任何其他报告中仍然看不到任何依赖项调用,例如sql命令.

We've tried adding new DependencyTrackingTelemetryModule().Initialize(TelemetryConfiguration.Active); but still don't see any dependency calls, like sql commands, in the Application Map nor in any other reports.

我们正在使用Entity Framework Core 1.1.1.

We are using Entity Framework Core 1.1.1.

在Visual Studio中,当我按F5键时,在ADO.NET下的诊断工具"窗口中会看到所有数据库调用.我还看到了Application Insights调用,但这些调用似乎仅针对页面加载而启动,而不针对任何依赖项启动.

In Visual Studio when I F5 I see all database calls in the Diagnostic Tools window under ADO.NET. I also see Application Insights calls but those seem to be launched only for page loads, not for any dependencies.

这甚至还受支持吗?如果支持,如何启用它?

Is this even supported yet and if it is, how do I enable it?

推荐答案

2.1-Beta2版本将支持netcoreapp1.1的HTTP依赖关系,该版本不久将在Nuget.org上提供.此版本已经在 myget ,但可能不是最终版本.

HTTP dependencies with netcoreapp1.1 will be supported in 2.1-Beta2 release that will shortly be available on Nuget.org. This version is already available on myget, but may be not the final build.

当前不支持Entity Framework Core依赖项跟踪.如果您想自己实现它(甚至可以做出贡献!),可以使用此PR作为起点:

Entity Framework Core dependencies tracking is currently not supported. If you would like to implement it yourself (and maybe even contribute !) you can use this PR as a starting point: https://github.com/Microsoft/ApplicationInsights-aspnetcore/pull/297.

EF支持的跟踪问题: https://github.com/Microsoft/ApplicationInsights-dotnet-server/issues/522

Tracking issue for EF support: https://github.com/Microsoft/ApplicationInsights-dotnet-server/issues/522

这篇关于如何在Asp.Net Core项目中使用Application Insights启用依赖项跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆