Link to home
Start Free TrialLog in
Avatar of RodionP
RodionP

asked on

Creating a deployment package for service

Hello I have an application that is a system service, and now I have to create a deployment package for it.

After installation I need my service to start automatically, and start everytime windows starts.

What do I have to do ?
ASKER CERTIFIED SOLUTION
Avatar of zahaby
zahaby

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zahaby
zahaby

and this one is very good too
with downloadable sample

http://www.codeproject.com/dotnet/simplewindowsservice.asp
In the installer code for your service, include the following:

ServiceProcessInstaller spi = new ServiceProcessInstaller();
spi.Account = ServiceAccount. LocalSystem;
            
ServiceInstaller si = new ServiceInstaller();
si.ServiceName = "Your Service Name";
si.DisplayName = "Your service name";
si.StartType = ServiceStartMode.Automatic; // THIS IS THE IMPORTANT LINE!!!!!!!
            
this.Installers.Add(si);
this.Installers.Add(spi);

Then register the service as usual.
P.S.  After you register the service, you need to restart the computer to start the service.
thx very much