Q:

Window Service fails to start after changing service name

I have a windows service that I wrote in Visual Studio. I was asked to change the service name, so I went into the ServiceInstaller properties and changed both the DisplayName and ServiceName properties. When I go to start the service through Windows Manager, I receive the following error:

The 'servicename' service on 'server name' started and then stopped. Some services stop automatically if they are in use by other services or programs.

The log file says:

Service cannot be started. System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.  To create the source, you need permission to read all event logs to make sure that the new source name is unique. 

Any help would be appreciated.
Thanks!

A:

Apparently you did not register an event source. It is quite possible name of your event source was derived from service name, and when you changed that your service was attempting to use new event source, which was not registered. 
Check in your service installer you are registering event source -- it has to be registered at the time service is installed, because it requires elevated admin permissions. See code snippets in this SO question for examples how to register that. 

