c# – WIndow Services Event ID – Education Career Blog

I’m doing a C# project window service. 1st time doing it.
I have managed to installed and checked that it is working.

1 thing that puzzle me is that when I see the event log, I notice all or almost all of the other services has its own Event ID. However in my project, I can’t find the place to put this event id.
Only saw a exit code, which I do not think is for this purpose.

Can someone guide me on how do I put a custom event id on my window service project as all the window service I created will have a event ID 0.



Event IDs are application-specific. You decide what they mean. More information:



EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning,  234);

The “234” code above is arbitrary, it could be any number. You can use this to develop a list of return codes so you can trace codes back to a particular type of log entry.

Leave a Comment