Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Using AfterInstall event</strong></p> <p>Create <code>AfterInstall</code> event in your Service Installer class and start service using <code>ServiceController</code>. </p> <pre><code>public ServiceInstaller() { InitializeComponent(); this.AfterInstall += new InstallEventHandler(ServiceInstaller_AfterInstall); } void ServiceInstaller_AfterInstall(object sender, InstallEventArgs e) { ServiceController sc = new ServiceController(serviceInstaller1.ServiceName); sc.Start(); } </code></pre> <p><strong>Using Committed event</strong></p> <pre><code>public ServiceInstaller() { InitializeComponent(); this.Committed += new InstallEventHandler(ProjectInstaller_Committed); } void ProjectInstaller_Committed(object sender, InstallEventArgs e) { ServiceController sc = new ServiceController(serviceInstaller1.ServiceName); sc.Start(); } </code></pre> <p><strong>Or you can override OnCommitted event</strong> </p> <pre><code> protected override void OnCommitted(System.Collections.IDictionary savedState) { base.OnCommitted(savedState); new ServiceController(serviceInstaller1.ServiceName).Start(); } </code></pre> <p>Other than above please check following </p> <ul> <li>Installer Start type : Automatic </li> <li>Account :Local System </li> </ul> <p>Other than the service installer you need to have setup project which created by giving primary output of above service installer.</p> <p><img src="https://i.stack.imgur.com/vOSaf.jpg" alt="enter image description here"></p> <p>in the setup create Custom action at least on install by giving service installer project output.</p> <p><img src="https://i.stack.imgur.com/GHqO8.jpg" alt="enter image description here"></p> <p>More information from <a href="http://How%20to%20create%20a%20setup%20project%20for%20a%20Windows%20Service%20application%20in%20Visual%20C#" rel="nofollow noreferrer">here</a>. Hope this help you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload