I have a service which is running in a system in several instances. I need to find DISPLAY_NAME of the service from the service. I’ve tried ServiceBase.ServiceName but it returns (probably) the name of service from the project installer, which is at least in this case useless.
The service is installed by installutil with a parameter /name=.
Edit
I have a workaround based on Imran Balouch answer. I read the name in the installer Me.Context.Parameters("name") and write it to ImagePath registry subkey and read it with Environment.GetCommandLineArgs in a service.
Have you added
ProjectInstallerin your windows service project? If yes than in ProjectInstaller you addServiceInstallerfor your service, and in that ServiceInstaller you can specify the display name of the service. Select that serviceinstaller and in properties set itsDisplay Nameor inInitializeComponentofProjectInstaller.Designer.csorProjectInstaller.Designer.vbyou can specify the display name as: