- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我将这些 Nuget 包添加到我的 WPF 应用程序中:
记录器正在记录一个文件,该文件有效。但没有数据传输到 Azure。我收到此错误:
我的问题:我应该在哪里(在代码中)初始化遥测 channel ?为什么我必须这样做?如果我必须添加遥测客户端(带有配置),那么附加程序有什么用?
最佳答案
更新 0603:
我的应用程序配置:
使用 Visual Studio 进行调试:
更新:请按照下面的屏幕截图,尝试查找您发送的信息。如果您仍然找不到该信息,请提供您详细的代码(删除个人/重要数据,如仪器 key ,并向我们提供您正在使用的 nuget 包和版本)。
1.点击概览页面的搜索按钮:
2.在搜索屏幕中,正确设置本地时间和事件类型,然后尝试搜索消息:
<小时/>您最好提供设置 log4net 和 app Insights key 的代码。
我用wpf项目做了一个简单的测试,下面的代码工作正常:
public partial class MainWindow : Window
{
private static readonly ILog log = LogManager.GetLogger(typeof(MainWindow));
public MainWindow()
{
TelemetryConfiguration.Active.InstrumentationKey = "the key";
log4net.Config.XmlConfigurator.Configure();
log.Info("wpf aaaa11111");
InitializeComponent();
}
}
您收到错误“AI:服务器遥测 channel 未初始化”,可能是由于某些不正确的配置,例如在上面的工作代码中使用以下代码:
//when add the code, it will cause the error you mentioned.
TelemetryConfiguration.Active.TelemetryChannel = new ServerTelemetryChannel();
如果您必须添加遥测客户端(带配置),并且通过正确的配置,log4net 和遥测客户端都可以将数据发送到应用程序洞察。代码如下:
public partial class MainWindow : Window
{
private readonly TelemetryClient telemetryClient;
private static readonly ILog log = LogManager.GetLogger(typeof(MainWindow));
public MainWindow()
{
//configure the key here for log4net
TelemetryConfiguration.Active.InstrumentationKey = "the key";
log4net.Config.XmlConfigurator.Configure();
var config = new TelemetryConfiguration();
//configure the key here for telemetry client
config.InstrumentationKey = "the key";
telemetryClient = new TelemetryClient(config);
log.Info("wpf aaaa333");
log.Info(TelemetryConfiguration.Active.TelemetryChannel.ToString());
telemetryClient.TrackTrace("it is going to start!");
InitializeComponent();
}
}
关于c# - 如何为 Application Insights Log4Net Appender 设置遥测 channel ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56222102/
用普通 Cordova 启动了一个项目。此消息不断出现: You have been opted out of telemetry. To change this, run: cordova tele
背景: 我正在处理一个非常古老的应用程序,它很少且间歇性地生成异常。 当前的做法: 通常我们程序员使用全局异常处理程序来处理罕见的未知数,像这样连接: [STAThread] [SecurityPer
我使用此代码通过 TelemetryClient 记录异常: var appInsightsRoleName = "tracking"; var telemetry = new ExceptionTe
Android 版本。 > 4.3标准安卓信标库估计信标。Eddystone-UID包遥测包。 我正在尝试从 Eddystone-UID 包传输的遥测包中读取温度传感器传输。根据 Android Be
我按照此 Microsoft article 设置了使用 Azure 的 Application Insights 在 IIS 上运行的本地 .NET 应用程序 。而且效果一直很好。 据我了解,这是一
我刚刚 fork 了新的 mapbox 库并试图将它作为一个模块添加到我的项目中。主要问题是 gradle 在同步时出错,因为我无法访问遥测 2.0.0-SNAPSHOT Error:Could no
我想在 Application Insights 的请求事件中包含 header ,并找到了以下帖子,其中包含针对具有 HttpContext 的应用程序的解决方案。我正在使用 Nancy 应用程序,
我需要使用遥测向 QnA 用户发送有关我的 Azure 机器人见解的问题和答案。已经尝试过本教程: https://docs.microsoft.com/en-us/azure/bot-service
我是 Azure Application Insights 的长期用户,并且经常使用 TelemetryClient 的 TrackTrace() 和 TrackException()我编写的每个企业
我们在 AKS 中托管了一个小型 API,它是使用 .Net core 2.2 编写的。它一直运行良好,我们已经在 Azure 门户中看到了我们所有的 App Insights 遥测数据,如预期的那样
我是一名优秀的程序员,十分优秀!