![](/img/trans.png)
[英]Monitoring Entity Framework performance in ASP.NET app with Application Insights Status Monitor
[英]Application Insights Codeless attach Status Monitor V2
我使用带有状态监视器 v2 的 IIS 上的 Application Insight Codeless Attach。
一切都很好,唯一的事情是我无法在洞察力上看到 SQL CommandText。
除了上述特定于平台的步骤之外,您还必须通过使用以下内容修改 applicationInsights.config 文件来明确选择启用 SQL 命令集合:
应用程序文件夹没有任何 applicationInsights.config 文件,因此无法添加以下内容:
<EnableSqlCommandTextInstrumentation>true</EnableSqlCommandTextInstrumentation>
我还尝试更改“ApplicationMonitor\version\content\runtime”下的 ApplicationInsights-default.config 和 ApplicationInsights-recommended.config 文件,但没有成功。
有人知道如何在没有代码实现的情况下添加此属性吗?
正如本文档所述,IIS 服务器需要使用Microsoft.Data.SqlClient
而不是System.Data.SqlClient
。
需要使用检测引擎或使用 Microsoft.Data.SqlClient NuGet package 而不是 System.Data.SqlClient 库
===========================测试结果=====================
I created a test asp.net core mvc app and used Microsoft.Data.SqlClient
, after deploying to azure web app and enable application insights, I can see sql query text like below.
我在不使用 Microsoft.Data.SqlClient 并且在应用程序中没有一行代码的情况下让它工作。 只需使用状态监视器 v2,启用检测并添加 -connectionstring 而不是 -instrumentationkey 或 -instrumentationkeymap。 这种方法的问题在于,当您部署应用程序时,检测服务似乎停止获取 sqlcommandtext,直到您重新启动它 -
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.