【发布时间】:2021-09-27 06:58:51
【问题描述】:
根据the documentation,您需要将以下内容添加到您的applicationInsights.config 文件中以启用完整的SQL 日志记录:
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
<EnableSqlCommandTextInstrumentation>true</EnableSqlCommandTextInstrumentation>
</Add>
但在我的 ASP.NET 应用程序中,在 Azure 应用程序服务中托管的 .NET Framework 4.7.2 上运行,我通过代码启用/配置 Application Insights:
TelemetryConfiguration.Active.DisableTelemetry = false;
TelemetryConfiguration.Active.InstrumentationKey = setting.ApplicationInsightsInstrumentationKey;
如何通过代码启用此设置?
P.S.:Web App 中的设置已正确启用。
【问题讨论】:
标签: c# sql asp.net azure azure-application-insights