How to enable dependency tracking with Application Insights in an Asp.Net Core project

断了今生、忘了曾经 提交于 2019-12-11 06:13:54

问题


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

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

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.

We are using Entity Framework Core 1.1.1.

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?


回答1:


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 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.

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



来源:https://stackoverflow.com/questions/43674695/how-to-enable-dependency-tracking-with-application-insights-in-an-asp-net-core-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!