如何使用Window Service配置Application Insight

时间:2017-08-19 08:12:25

标签: azure-application-insights

我已在.net中使用窗口服务配置了Application Insight,但是我还添加了仪器密钥,但我无法在洞察中发布遥测数据。任何人都可以建议。

TelemetryClient tc = new TelemetryClient();
// Alternative to setting ikey in config file:
tc.InstrumentationKey = "8fccf8e5-0ef5-47f9-9f8b-5fc1f92a8f36";// "4637b838-11f4-41c0-a67e-ef03676c7339";
tc.TrackRequest("testRequest", DateTime.Now.Date,ts, "100", true);
// Set session data:
tc.Context.User.Id = "Pradeep";
tc.Context.Session.Id = Guid.NewGuid().ToString();
tc.Context.Device.OperatingSystem = Environment.OSVersion.ToString();
tc.TrackTrace("Trace-Test", SeverityLevel.Information);
// Log a page view:
tc.TrackPageView("Form3");

0 个答案:

没有答案