Обнаружена проблема после входа в Sysinternals 'Process Monitor , немного больше:
Вызов EventLog.Exists("MyLog");
Имя журнала не найдено, как и ожидалось в:
KLM \ System \ CurrentControlSet \ services \ eventlog \ MyLog
Вызов EventLog.SourceExists("MySource");
Проверяет несколько мест, имя не найдено, как ожидалось:
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Application \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ HardwareEvents \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Internet Explorer \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Служба управления ключами \ MySource
HKLM\ System \ CurrentControlSet \ services \ eventlog \ Media Center \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ ODiag \ MySource
HKLM \ System \ CurrentControlSet \services \ eventlog \ OSession \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Security \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ System \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \VisualSVNServer \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Windows PowerShell \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Application \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ HardwareEvents \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Internet Explorer \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Служба управления ключами \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Медиа-центр \ MySource
HKLM\ System \ CurrentControlSet \ services \ eventlog \ ODiag \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ OSession \ MySource
HKLM \ System \ CurrentControlSet \ services\ канунаntlog \ Security \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ System \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ VisualSVNServer \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Windows PowerShell \ MySource
HKLM \ System \ CurrentControlSet \ services \ eventlog \ MyLog
Тем не менее, вызов EventLog.CreateEventSource("MySource", "MyLog");
Находит MyLog в следующем месте реестра и ошибки:
HKLM \ System \ CurrentControlSet \ services \ eventlog \ Application \ MyLog
Удаление "HKLM \ System \ CurrentControlSet \ services \ eventlog \ Application \ MyLog" и повторный запуск исправили мою проблему!
Похоже, .Exists
не выглядит во всех местах .CreateEvent
делает!