Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

EntryWrittenEventHandler delivers large number of very old events

$
0
0

I have the following code which is using the "EntryWrittenEventHandler" class. It is running on thousands of machines very well. But in the last weeks I get a very strange behavior on more and more machines, where the EventHandler delivers a very large number of very old events recursively. The "if part" of the code is executed (marked with "Unwanted Block") very rapidly. It happens on W2K12 and W2K12 R2 servers with up-to-date Framework 4 versions and probably on other systems. I couldn't reproduce this problem in our test environment. What can I do to figure out the problem or to resolve it?

For the same Problem please also see link http://stackoverflow.com/questions/16031610/strange-eventlog-behaviour-on-windows-server-2008-r2. There could be no answer found.

EventLog _EventLog_Sec = new EventLog("Security");
_EventLog_Sec.EntryWritten += new EntryWrittenEventHandler(OnEntryWritten_Sec);
_EventLog_Sec.EnableRaisingEvents = true;

public static void OnEntryWritten_Sec(object source, EntryWrittenEventArgs e)
{
 try
 {
  //Damit keine alten Events gesendet werden
  if(e.Entry.TimeGenerated < DateTime.Now - TimeSpan.FromMinutes(5))
  {
                   ...//Unwanted Block!!!
  }
  ...
 }
        catch {}
}


Viewing all articles
Browse latest Browse all 8156

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>