Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing InstallUtil to install a Windows service with startup parameters
    primarykey
    data
    text
    <p>I am using InstallUtil to install my service and I just cannot figure out how to specify the startup parameters for it!</p> <p>Here is my Installer subclass:</p> <pre><code>[RunInstaller(true)] public class ServerHostInstaller : Installer { private ServiceInstaller m_serviceInstaller; private ServiceProcessInstaller m_serviceProcessInstaller; private static string s_usage = "Usage:\ninstallutil /i /username=&lt;user_name&gt; /password=&lt;user_password&gt; NCStub.Server.Host.exe"; public ServerHostInstaller() { m_serviceInstaller = new ServiceInstaller(); m_serviceInstaller.ServiceName = Program.ServiceName; m_serviceInstaller.DisplayName = Program.ServiceName; m_serviceInstaller.StartType = ServiceStartMode.Automatic; m_serviceProcessInstaller = new ServiceProcessInstaller(); m_serviceProcessInstaller.Account = ServiceAccount.User; Installers.Add(m_serviceInstaller); Installers.Add(m_serviceProcessInstaller); } public override void Install(IDictionary stateSaver) { base.Install(stateSaver); string userName = this.Context.Parameters["username"]; if (userName == null) { Console.WriteLine(s_usage); throw new InstallException("Missing parameter 'username'"); } string userPass = this.Context.Parameters["password"]; if (userPass == null) { Console.WriteLine(s_usage); throw new InstallException("Missing parameter 'password'"); } m_serviceProcessInstaller.Username = userName; m_serviceProcessInstaller.Password = userPass; } } </code></pre> <p>Can anyone indicate how do I specify the service startup parameters? </p>
    singulars
    1. This table or related slice is empty.
    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.
 

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