它正在捕获 Application Insights 中的 .net 4.6 应用程序支持的 SQL 命令文本?

It is capturing SQL command text supported in .net 4.6 application in Application Insights?

想象一下 .NET 4.6 控制台应用程序,它使用 ADO.NET 查询 sql 数据库。

    static void Main(string[] args)
    {
        TelemetryConfiguration.Active.InstrumentationKey = "my key";

        var tc = new TelemetryClient(TelemetryConfiguration.Active);

        tc.TrackEvent("App start");

        string ConnString = "Data Source=localhost;Initial Catalog=MyDb;Persist Security Info=True;User ID=sa;Password=****;MultipleActiveResultSets=True";
        string SqlString = "Select * From Customers";
        using (SqlConnection conn = new SqlConnection(ConnString))
        {
            using (SqlCommand cmd = new SqlCommand(SqlString, conn))
            {
                cmd.CommandType = CommandType.Text;

                conn.Open();
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    var res = reader.Read();
                }
            }
        }


        tc.TrackEvent("App stop");
        tc.Flush();
        Thread.Sleep(5000);
    }

在这种情况下支持捕获 SQL 命令文本?或者它仅在 IIS 和 Azure 应用程序上受支持?

在此示例中,我希望在依赖事件中看到有关 Application Insights 的文本 "Select * From Customers",但该文本不存在。只有很少的其他属性(如持续时间、客户端 IP 等)存在依赖性,但没有 sql 文本。

sql 语句由 "status monitor" 收集,运行 作为 .net 分析器在运行时在 Web 应用程序上使用。

https://docs.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-dependencies

我会四处打听,但我非常确定如果不跳过 就很难将其连接到非网络应用程序很多 圈。