phatboyg / Topshelf

An easy service hosting framework for building Windows services using .NET
http://topshelf-project.com/
Apache License 2.0
170 stars 1 forks source link

Topshelf.Host always sets service start mode as Automatic, omitting --autostart has no effect #15

Closed Craigology closed 12 years ago

Craigology commented 12 years ago

There is a command-line switch "--autostart", which instructs the installer to configure the service with start mode set to Automatic. There are no command-line switches available to specify an alternate start mode.

InstallBuilder sets the default start mode to Automatic.

Therefore regardless of the presence/absence of "--autostart", the service start mode will always be set to Automatic.

Options (in increasing effort):

  1. InstallBuilder should set the default start mode to Manual.
  2. Add command-line switch "--manual" which will map to StartModeExtensions.StartManually().
  3. Add configuration validation to ensure that "--autostart" and "--manual" are not employed concurrently.
  4. For completeness, the start mode of "Disabled" should also be supported.

Note: unit tests in this area are currently commented-out. See Configuring_a_service_using_the_runner.Should_not_be_set_to_start_automatically().

phatboyg commented 12 years ago

The reboot fixes, this, as well as adding disabled, and delayed-autostart (on .NET 4.0 only).

Craigology commented 12 years ago

Sorry, I'm relatively new to the Topshelf community and don't follow - what do you mean by "the reboot fixes this"?

phatboyg commented 12 years ago

I'm sorry, I should have linked the blog post:

http://blog.phatboyg.com/2012/07/23/rebooting-topshelf-for-version-3/