Windows service and EvenLog problem NET.2.0



I have created WS and Setup project. Created EventLog source and
custom log with EventLogInstaller.
Event log and source are created. WS is run as LocalSystem account so
the problem with write permissions for event log aren't problem
(installation is also executed with the same one).

Service is started with custom installation step and works fine.
But there are few issues that are raised doing all this:

1) i don't want to restart server/computer with service being
2) but without that restart all my entries written to my custom event
log end up in Application log with error:
The description for Event ID ( 0 ) in Source ( XXXX ) cannot be found.

found suggestions to write registry value for:

EventMessageFile = C:\WINDOWS\Microsoft.NET\Framework

but that also doesn't help.
In some weird cycle i got this things working but after deleting
source and custom log, restarting and installing WS again got the same

Anyone knows how to force OS to refresh event source list (found that
on MSDN :) ) or any other way how to work this out?

Latish Sehgal

Could you try giving a time gap between the creation of log and
writing to the log, just as a test (using Sleep()).
I remember reading somewhere that there is a time gap between creation
of log source and its availability. This might explain how you got
this to work in "some weird cycle". Perhaps you were debugging and
introduced a time gap at the right place.


Latish Sehgal je napisao/la:
Found a thread that might be useful to you, check out the last post.

Unfortunatly it doesn't help :(

maybe the story is a bit different with windows services?! don't
know... the thing why i would like that eventlog would work like this
is rebooting server after service installation... i don't want to do
that... haven't tried it yet on win2k3 but hope it doesn't work like
this on that OS :(


I can confirm that anything I have tried from thread mentioned above
doesn't help :(

Anyone had similar problem?

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question