Multiple services of Topshelf enabled binary


just trying to get started with OD. I have a question about Windows services. Currently we use the Topshelf API to register services. In particular to register multiple instances on a single machine.

If I understand your Docs correctly, this would not be supported as of this:

The only caveat is the value you specify in the Service Name parameter must match the Service Name specified in your Topshelf configuration code (in Program.cs) or the service will not start.

Am I correct here or am I missing something?

What would be the proposed way of deploying multiple instances through OD? I can see the following options for now

  • Don’t use Topshelf and use different service names in OD deployment step (not a real option atm)
  • Write a custom deployment script to employ the Topshelf API

Or as a 3rd option maybe pass the service name as a parameter to the .exe so that SetServiceName of Topshelf receives the name as it starts.

Hi Dan,

Thanks for getting in touch! I have had this question come through a couple of times and unfortunately I am not able to provide you with a very informative answer. From what I have seen it will require you write a custom deployment script for this to work on your end as you have suggested.

Though I don’t think it directly answers your questions. The best resource I have found for using Octopus with Topshelf would be the following blog post:

Have you tried your recent suggestion? If you have any success with the methods you have mentioned I would love to hear about it and potentially help future enquiries regarding Topshelf.

Sorry for not being very helpful here.

Best regards,

The link looks interesting. I will play around with my ideas and what is already there to see what works best. I hope to find the time to do so and probably share my conclusions on this topic.

Thanks for your input!

Hi Dan,

Thanks for getting back! We would love to hear what you come up with. :slight_smile:

Best regards,