Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to pass arguments to `Configuration.Install.Installer` when installing a long-running service through `installutil`
    primarykey
    data
    text
    <p>I have an application that I want to run as a <em>Windows Service</em>. Following instructions provided in <a href="http://msdn.microsoft.com/en-us/library/ms733069%28v=vs.100%29.aspx" rel="noreferrer">this MSDN doc page</a> (I need to host a <em>WCF</em> service, so the procedure also details this part), I can do that, and if I implement the example service it is all right. I use <code>installutil.exe</code> utility and can install and uninstall my application as a Windows Service.</p> <h2>My problem</h2> <p>However I need to install more service of the same application on my local machine. So I need to give them different <code>System.ServiceProcess.ServiceBase.ServiceName</code>s! So consider again the installation code:</p> <pre><code>[RunInstaller(true)] public class ProjectInstaller : Installer { private ServiceProcessInstaller process; private ServiceInstaller service; public ProjectInstaller() { process = new ServiceProcessInstaller(); process.Account = ServiceAccount.LocalSystem; service = new ServiceInstaller(); service.ServiceName = /* NEED TO PUT HERE THE NAME!!! */; Installers.Add(process); Installers.Add(service); } } </code></pre> <p>Is there a way for me to pass the name of the service when calling <code>installutil.exe</code>? How to approach to this problem? I also tried using the <code>App.Config</code> file and doing something like this:</p> <pre><code>public ProjectInstaller() { process = new ServiceProcessInstaller(); process.Account = ServiceAccount.LocalSystem; service = new ServiceInstaller(); service.ServiceName = System.Configuration.ConfigurationManager. AppSettings["SrvName"]; Installers.Add(process); Installers.Add(service); } </code></pre> <p>But of course it did not work, this file is called when the application runs!!!</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