Visual Studio 或 Azure 中未显示 Insight 消息

Insight messages not showing in Visual Studio or Azure

我在调试 window 中看到 AI 消息,但在诊断 window/ hub 、Azure 或应用程序洞察 VS 屏幕中看不到,

调试window Application Insights 遥测:{"name":"Microsoft.ApplicationInsights.e71aa06ae1d142b4ae04393d63a71d57.Exception","time":"2016-07-16T09:46:37.7435251Z","iKey":"xyz","tags": 等等

没有使用配置文件

        for (;;)
        {
            var telemetryClient = new TelemetryClient();
            telemetryClient.InstrumentationKey = "abc";
            telemetryClient.Context.Session.Id = Guid.NewGuid().ToString();
            telemetryClient.Context.User.AccountId = "Ben";
            telemetryClient.Context.Component.Version = "1.0";
            telemetryClient.TrackEvent("Application Start");

            telemetryClient.TrackException(new ApplicationException("test exc"));
            telemetryClient.Flush();
            Thread.Sleep(3000);
        }

这在几个解决方案中,一个是 Console,另一个是 .Core。有什么想法吗?

添加诊断显示。 属性 的值 '无法从存储中加载项目。文件:20160531051527_dbd26772482e4dbab6791b63f0ded9d3.trn 异常:System.UriFormatException:无效的 URI:无法确定 URI 的格式。 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(任务任务) 在 vshub.exe 的 Microsoft.ApplicationInsights.Channel.Storage.Peek()' 找不到。默认情况下填充它。: OnNext: {0} 属性 的值 '无法从文件加载传输。文件完整路径:C:\Users\bklooste\AppData\Local\Microsoft\ApplicationInsights\vstelAIF-312cbd79-9dbb-4c48-a7da-3cc2a931cb70160712090841_9436f519411b4a10b4f551897382fcc6.trn,异常:System.UriFormatException:无效的 URI:无法确定 URI 的格式。 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(任务任务) 未找到 vshub.exe 的 Microsoft.ApplicationInsights.Channel.Storage.d__14.MoveNext()'。默认情况下填充它。: OnNext: {0} 属性 的值 '无法从存储中加载项目。文件:20160712090841_9436f519411b4a10b4f551897382fcc6.trn 异常:System.UriFormatException:无效的 URI:无法确定 URI 的格式。 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(任务任务)

可能不是答案,但会帮助那些搜索此堆栈跟踪但不阅读问题评论的人。

OP 的问题在他们检查 Instrumentation Key 时得到了解决。

vshub.exe 尝试读取位于 C:\Users\bklooste\AppData\Local\Microsoft\ApplicationInsights\vstelAIF-312cbd79‌​-9dbb-4c48-a7da-3cc2a931cb70 的文件以发送离线遥测时,堆栈跟踪生成。

此离线遥测由 Application Insights Persisted HTTP 包提供。在不知道文件的实际内容的情况下,文件中似乎有一些损坏。该文件应该类似于下面的代码片段。如果由于某种原因文件被截断或 URI 实际上格式错误,则将抛出此异常。

您需要更正 URI,或者(最好)只删除文件。

https://vortex.data.microsoft.com/collect/v1
Content-Type:application/x-json-stream
Content-Encoding:gzip

H4sIAAAAAAAEAJV...