Windows Service - ServiceName Doesn't show in Event Log

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mmaslar
    New Member
    • Aug 2008
    • 8

    #1

    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.ServiceNam e = "MyService" ; then nothing gets written to the event log when the service starts or stops. Ho do I change that message?

    Thanks!
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    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.

    Comment

    • mmaslar
      New Member
      • Aug 2008
      • 8

      #3
      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.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        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?

        Comment

        • mmaslar
          New Member
          • Aug 2008
          • 8

          #5
          Thanks! It's working.

          Comment

          Working...