Alex Rivera | Logout

How can I change the name of a windows service?

Asked 2010-10-08T03:01:57.790
14

I have a windows service application developed in C#. The same service needs to be run with different config files. To run on these on the same machine I would need to change the name of the service. I can create multiple copies of the solution, but not sure how to change the names of the services.

Thanks

Edit
Report

1 Answer

12

In your win service class that derives from ServiceBase, there is a property that is inherited that you can set called ServiceName. You could make an app.config, add a setting for the service name and have your win service class assign that property accordingly. That way each service name will be unique as long as you change the setting in the app.config.

answered 2010-10-08T03:24:33.893

Your Answer