开发者

Unable to monitor the Security Event Log

I have this code:

{
    EventLog ev = new EventLog("Security");
    ev.EntryWritten += new EntryWrittenEventHandler(ev_EntryWritten);
}

static void ev_EntryWritten(object sender, EntryWrittenEventArgs e)
{
    log_to_file("ev_EntryWritten");
}
开发者_如何学运维

But I receive no security events whatsoever. The program runs as a Windows Service on XP SP3. What am I missing?


Make sure you set EnableRaisingEvents = true;

Also, I would run it as a normal application first prior to running it under a service account. Make sure it isn't running under LocalSystem but some other user that is defined for that service as the logon user. You will not see GUI for a service so Console.WriteLine is useless.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜