How to install a .NET windows service without InstallUtil.exe vb.net

22,430

Solution 1

Installutil is necessary, but to make things easier, you can create a Setup project, so that you simply run an .msi to install the service. (This uses installutil under the hood, but it greatly simplifies installation.)

One walkthrough is here: http://support.microsoft.com/kb/816169

And another is here: http://msdn.microsoft.com/en-us/library/zt39148a(VS.80).aspx

The main difference between the two is the amount of code in the samples. They both walk you throuigh the same process.

The articles linked to are old, but still apply in VS2010. I used the second article to walk through the process for a VS2010 service just last week.

Solution 2

Why do you want to avoid installutils?

You could try using the sc command, as in sc create ...

EDIT: Here's an MSDN page for it: http://support.microsoft.com/?kbid=251192

DESCRIPTION:
        Creates a service entry in the registry and Service Database.
USAGE:
        sc <server> create [service name] [binPath= ] <option1> <option2>...

OPTIONS:
NOTE: The option name includes the equal sign.
      A space is required between the equal sign and the value.
 type= <own|share|interact|kernel|filesys|rec>
       (default = own)
 start= <boot|system|auto|demand|disabled|delayed-auto>
       (default = demand)
 error= <normal|severe|critical|ignore>
       (default = normal)
 binPath= <BinaryPathName>
 group= <LoadOrderGroup>
 tag= <yes|no>
 depend= <Dependencies(separated by / (forward slash))>
 obj= <AccountName|ObjectName>
       (default = LocalSystem)
 DisplayName= <display name>
 password= <password>

Solution 3

You can always do it with registry entries.
The keys are found in HKLM\SYSTEM\CurrentControlSet\services

The key name you create is the embedded name of the service on your service handler. The following values are relevant:

DisplayName = text that gets displayed in the services manager

ImagePath = FQ Filename of service executable

Start (DWORD) = startup type (3 = autostart)

DelayedAutoStart (DWORD) = (1 = delayed)

WOW64 (DWORD) = (0 = 64-bit app, 1 = 32-bit app)

ErrorControl (DWORD) = 0

ObjectName = {username} to run under (LocalSystem for system account)

There are lots of other values, but that should get you started.

Share:
22,430
Simon
Author by

Simon

Updated on January 31, 2020

Comments

  • Simon
    Simon over 4 years

    I have created a windows service in vb.net. Is there anyway i can create an installation for it that does not require installutil to be used?