You can get very easily get real close to what you are trying to acheive.
You can pass command line parameters to a service, and have it start as a
regular windows app - makes debugging a lot simpler. I blogged about that at
one point right here -
http://www.codebetter.com/blogs/sahil.malik/archive/2004/12/06/35295.aspx
And then you can also install it as a service using MSI or command line
tools (msi preferred). Once it is installed, then you can use it as either
command line (it is an exe afterall) or as a service.
If you really really wanted the exe to be smart enough to register itself as
a service - when run without parameters, you can use Win32 Api to install a
service - the overall approach remains the same as described in my blog post
at http://www.codebetter.com/blogs/sahil.malik/archive/2004/12/06/35295.aspx
- Sahil Malik [MVP]
Upcoming ADO.NET 2.0 book - http://tinyurl.com/9bync
----------------------------------------------------------------------------
---------------
> I used to create services in a 'self-installing' way: a single executable
> that serves both as the service executable and as configuration/install
[quoted text clipped - 10 lines]
> or from ServiceMain, the service entry point that's passed to the SCM by
> main()?
Lucvdv - 07 Jun 2005 07:44 GMT
> You can get very easily get real close to what you are trying to acheive.
> You can pass command line parameters to a service, and have it start as a
> regular windows app - makes debugging a lot simpler. I blogged about that at
> one point right here -
> http://www.codebetter.com/blogs/sahil.malik/archive/2004/12/06/35295.aspx
Thanks, I'll have a look at it.