469,360 Members | 1,774 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

Windows Service - ServiceName Doesn't show in Event Log

I'm writing a Windows Service. When it starts running, "Service started successfully." is written to the Event Log, w/ a Source of "Service1". Cool -- this happens by default.

I'd rather a different service name show up in the event log. But if I add this statement this.ServiceName = "MyService"; then nothing gets written to the event log when the service starts or stops. Ho do I change that message?

Thanks!
Oct 23 '08 #1
4 12155
Plater
7,872 Expert 4TB
Maybe change its name in the assembly?
Edit: Ok I see where that value comes from now.
Double click on the Service1.cs (or whatever you named it)
The properties box will change to reflect the object.
I would say try changing the (Name) property as well as the ServiceName property.
Oct 23 '08 #2
The property's ServiceName was indeed set to "Service1". (AutoLog is True).

When I change ServiceName to "MyService", it's back to nothing being logged.
Change it back to Service1 and Service1 gets logged to the Event Log again...

I searched the entire Solution for Service1. Nothing else found.
Oct 23 '08 #3
Plater
7,872 Expert 4TB
Well did you correct the name in the installer portion of the service project?
The name that shows up in services.msc is the name I see in the System event log
The failures logged in the Application log show Service1. When I changed the settings as I mentioned earlier and uninstalled/reinstalled, the Application log showed me the correct name of "myService" (which what I changed the name to)


Are you remembering to do a full uninstall of the service and then reinstall it?
Oct 23 '08 #4
Thanks! It's working.
Oct 24 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Fabio Papa | last post: by
9 posts views Thread by Hardy Wang | last post: by
2 posts views Thread by Fan Wang | last post: by
8 posts views Thread by Jerry Camel | last post: by
5 posts views Thread by Andrew | last post: by
3 posts views Thread by Mika M | last post: by
5 posts views Thread by dm3281 | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.