C# 使用WMI监视事件日志
我尝试使用WMI监视EntryWrited事件的事件日志,因此我按如下方式设置了处理程序:C# 使用WMI监视事件日志,c#,wmi,C#,Wmi,我尝试使用WMI监视EntryWrited事件的事件日志,因此我按如下方式设置了处理程序: // Create the event log monitor string query = "Select * From __InstanceCreationEvent Where TargetInstance.LogFile='Application'"; WqlEventQuery aProcessCreationQuery = new WqlEventQuery(q
// Create the event log monitor
string query = "Select * From __InstanceCreationEvent Where TargetInstance.LogFile='Application'";
WqlEventQuery aProcessCreationQuery = new WqlEventQuery(query);
ManagementEventWatcher aWatcher = new ManagementEventWatcher(aProcessCreationQuery);
aWatcher.EventArrived += new EventArrivedEventHandler(EventLogMonitor);
但是我的处理程序方法EventLogMonitor从不激发,即使在将内容写入应用程序事件日志时也是如此。我的应用程序作为服务运行,监视写入事件日志的内容
我发现某个地方可能需要添加一行:
aWatcher.Start()
在StartService()方法中,但如果我这样做,服务将不会启动。我想知道是否有人对此有什么想法?你的看法是错误的
从TargetInstance.LogFile='Application'所在的InstanceCreationEvent中选择*
您必须使用ISA
关键字在句子中包含您正在检查的类
差不多
从InstanceCreationEvent中选择*,其中TargetInstance是“Win32”和TargetInstance.LogFile='Application'
您认为错误
从TargetInstance.LogFile='Application'所在的InstanceCreationEvent中选择*
您必须使用ISA
关键字在句子中包含您正在检查的类
差不多
从InstanceCreationEvent中选择*,其中TargetInstance是“Win32”和TargetInstance.LogFile='Application'