Home All Groups Group Topic Archive Search About

Installing a windows service

Author
7 Dec 2006 9:36 PM
BK
I've created a windows service and tested it.  It works the way I want
it to.  I added a ProjectInstaller and set the appropriate properties
in my Windows Service project.  To install it, I went to a Visual
Studio Command Prompt and issued the appropriate InstallUtil
<path\executable> command and the service runs perfectly on my
development machine.  What I can't figure out is how to install on it
any other machine.  Any pointers or links to information would be
appreciated, I've search the 'net and this newsgroup and haven't found
an answer.

Author
7 Dec 2006 10:25 PM
Chris Dunaway
BK wrote:
> I've created a windows service and tested it.  It works the way I want
> it to.  I added a ProjectInstaller and set the appropriate properties
> in my Windows Service project.  To install it, I went to a Visual
> Studio Command Prompt and issued the appropriate InstallUtil
> <path\executable> command and the service runs perfectly on my
> development machine.  What I can't figure out is how to install on it
> any other machine.  Any pointers or links to information would be
> appreciated, I've search the 'net and this newsgroup and haven't found
> an answer.

This may not be what you want, but I used the code at this link:
http://tinyurl.com/yexh6z to make my service self-installable.  It adds
a /install and /uninstall switch to be able to install the service.

You can use this code and then add a step to your install project to
get the service to install itself.

Chris
Author
8 Dec 2006 1:36 AM
Blake
^^^ What he says. :-)

I make every windows service self-installable now. Saves a lot of
hassle.

It is also possible to create a single exe that can be a service *and*
a stand alone app.

If you want to get super-creative you can make your exe also behave as
a console listener for the
service if the service is installed and running.

-Blake

Show quoteHide quote
On Dec 8, 9:25 am, "Chris Dunaway" <dunaw***@gmail.com> wrote:
> BK wrote:
> > I've created a windows service and tested it.  It works the way I want
> > it to.  I added a ProjectInstaller and set the appropriate properties
> > in my Windows Service project.  To install it, I went to a Visual
> > Studio Command Prompt and issued the appropriate InstallUtil
> > <path\executable> command and the service runs perfectly on my
> > development machine.  What I can't figure out is how to install on it
> > any other machine.  Any pointers or links to information would be
> > appreciated, I've search the 'net and this newsgroup and haven't found
> > an answer.This may not be what you want, but I used the code at this link:http://tinyurl.com/yexh6zto make my service self-installable.  It adds
> a /install and /uninstall switch to be able to install the service.
>
> You can use this code and then add a step to your install project to
> get the service to install itself.
>
> Chris
Author
8 Dec 2006 1:38 PM
BK
Thanks, this will get me started.
Author
11 Dec 2006 3:22 PM
BK
I was looking for a managed code solution, or even just a way to
manually install the service on another machine.  This service will
only be used on one machine, perhaps a few machines at some point down
the road.  For now, I need to find a way to install it on to a machine
easily, it doesn't even have to happen programatically.  Thanks in
advance,

BK
Author
15 Dec 2006 8:50 AM
Master Programmer
Just write values to the registry....

"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MyService",
"DisplayName", "My Program Description"

"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MyService",
"ErrorControl", 1

"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MyService",
"ImagePath", "C:\MyExe.exe"

"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MyService",
"ObjectName", "LocalSystem"

"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MyService",
"Start", 2

"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MyService",
"Type", 272


The Grand Master

BK wrote:
Show quoteHide quote
> I was looking for a managed code solution, or even just a way to
> manually install the service on another machine.  This service will
> only be used on one machine, perhaps a few machines at some point down
> the road.  For now, I need to find a way to install it on to a machine
> easily, it doesn't even have to happen programatically.  Thanks in
> advance,
>
> BK
Author
11 Dec 2006 4:42 PM
BK