Installing a windows service

  • Thread starter Thread starter BK
  • Start date Start date
B

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.
 
BK said:
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
 
^^^ 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
 
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
 
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
 
Back
Top