I hope you will help me...
It's not only C# and .NET, but also WinAPI thread, so sorry if I've missed right forum to post my thread.
Here is my problem:
There is a event provider called "Service Control Manager" under System event log. It's EventMessageFile is %SystemRoot%\system32\services.exe. It contains an event with id = 7036 and this event is "The %1 service entered the %2 state". You can generate it very simple by stopping or running any services in services.msc.
All that I want is to write that event to System event log by myself.
Here is my simple logging code:
using System;
using System.Diagnostics;
using System.Diagnostics.Eventing;
class MySample
{
public static void Main()
{
EventLog myNewLog = new EventLog("System", ".", "Service Control Manager");
myNewLog.WriteEntry("Test",EventLogEntryType.Information, 7036);
}
}
I run the application with "Run as administrator". Event was written to System log with right event id, source, etc. But the description was "the message resource is present but the message is not found in the string/message table" insted of "The Test service entered the %2 state".
What is my mistake?


Sign In
Create Account

Back to top









