App Insights Telemetry 离线时不发送

App Insights Telemetry not sending when offline

我正在为我一直致力于捕获一些简单遥测的 wpf 应用程序使用 application insights sdk。我正在加载看起来像这样的配置文件

<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
<TelemetryProcessors>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor, Microsoft.ApplicationInsights"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
        <MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
        <ExcludedTypes>Event</ExcludedTypes>
    </Add>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
        <MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
        <IncludedTypes>Event</IncludedTypes>
    </Add>
</TelemetryProcessors>

问题是当我 运行 安装的应用程序处于离线状态时,遥测数据被捕获得很好。下次我在线时打开应用程序时,数据最终会被推送到应用程序洞察力中。但是,当其他人 运行 使应用程序脱机时,他们的数据永远不会在他们重新联机时被推送到应用程序洞察力。

这里配置的方式有问题吗?为什么这对某些用户有效但对其他用户无效?

编辑:今天与一位用户打交道时,我注意到当他们处于离线状态并且 运行打开应用程序时,没有保存任何临时文件。当我在我的电脑上做同样的事情时,我注意到创建了一个奇怪的临时文件。当我 运行 应用程序重新上线时它就消失了。

在用户机器上调试并深入研究代码后,我发现服务器遥测通道使用此功能 NetworkInterface.GetIsNetworkAvailable();,即使用户处于离线状态,它也始终 returns 为真因为他们有一些额外的网络适配器认为他们连接到未知网络。

您是否检查过 https://docs.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-troubleshoot-no-data 或尝试使用其他机器 运行 您的应用程序? 看起来可能是防火墙问题或类似问题。