Select Page
This entry has been published on 2013-05-02 and may be out of date.

Last Updated on 2013-05-02.

In your installer class of the service itself, use the event AfterInstall to start the service. After setup has finished, the service will start.

public ProjectInstaller()

            AfterInstall += new InstallEventHandler(ProjectInstaller_AfterInstall);

        void ProjectInstaller_AfterInstall(object sender, InstallEventArgs e)
            System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController(serviceInstaller.ServiceName);

Also have a look at this Source.