Ich habe eine grundlegende Konsole App mit AI nach dem Blog https://azure.microsoft.com/en-us/documentation/articles/app-insights-windows-desktop/ erstellt, jedoch keine Messwerte in AI meines Azure-Kontos erfasst. Es gibt auch keinen Fehler/Ausnahme gemeldet. Fehle ich hier etwas? Unten ist der Code. Es gibt eine Dokumentation, die besagt, dass HockeyApp der neue Ansatz zum Erfassen von Metriken für Windows-Apps ist, die über den App Store verfügbar gemacht werden, aber es gibt nicht genügend Informationen für Konsolen- oder Windows-Dienste. Kannst du deine Erfahrung teilen?Application Insights für eine Konsolenanwendung funktioniert nicht
using System;
using Microsoft.ApplicationInsights;
namespace Logger
{
class Program
{
static void Main(string[] args)
{
TelemetryClient tc = new TelemetryClient();
tc.Context.User.Id = Environment.UserName;
tc.Context.Session.Id = Guid.NewGuid().ToString();
tc.Context.Device.OperatingSystem = Environment.OSVersion.ToString();
tc.TrackPageView("Form1");
tc.Flush();
System.Threading.Thread.Sleep(1000);
}
}
}
ApplicationInsights.config
<applicationinsights xmlns="http://schemas.microsoft.com/A...">
<instrumentationkey>
mykey
</instrumentationkey>
<telemetrychannel type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
<telemetryprocessors>
<add type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<maxtelemetryitemspersecond>5</maxtelemetryitemspersecond>
</add>
</telemetryprocessors>
<telemetryinitializers>
<add type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<add type="Microsoft.ApplicationInsights.WindowsServer.DomainNameRoleInstanceTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<add type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
</telemetryinitializers>
<telemetrymodules>
<add type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
<add type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
<add type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
</telemetrymodules>
<severity>Verbose</severity>
</applicationinsights>
Windows 10 Enterprise, Version 1703, Build 15063.786, es funktioniert für mich. FYI. Obwohl es nicht wichtig sein sollte, sieht mein Code wie Ihr aus, außer dass ich den InstrumentKey programmatisch setze. ex:/* tc = neuer TelementryClient */tc.Context.InstrumentationKey = instrumentationKey; Meine Pakete waren: –
granadaCoder