Basically, I need to do the same thing as Per. i.e., I want N different services, all pointing to the same executable (which implements the same set onStart, onStop, etc.)
I don't quite get however, what to do about setting Service Name in the Main() of the Service's VB file and its associated ProjectInstaller (it this what is being talked about here??). What I mean is that I have a service, called MyService defined within MyService.vb (one instance, one name for now), and such a Service has a Main method which gas the following ServicesToRun = New System.ServiceProcess.ServiceBase() {New MyService ()} System.ServiceProcess.ServiceBase.Run(ServicesToRun) Next, I have my ProjectInstaller.vb (added by clicking on the link Add Installer) in the service's design view. It has the following line: Me.ServiceInstaller1.ServiceName = "MyService" 'ProjectInstaller ' Me.Installers.AddRange(New System.Configuration.Install.Installer() _ {Me.ServiceProcessInstaller1,Me.ServiceInstaller1, }) Finally, the Project's Property is define to have output of type WindowsApplication, with a startup object being MyService. OK, I get I could read config files, etc from ProjectInstaller.vb, but how could that "create and change" the service name in MyService.vb and add the appropriate installer accordingly? >Date: Tue, 26 Feb 2002 13:29:09 -0800 >Reply-To: dotnet discussion <[EMAIL PROTECTED]> >Sender: dotnet discussion <[EMAIL PROTECTED]> >From: Scott Boston <[EMAIL PROTECTED]> >Organization: spacehug.com >Subject: Re: Multiple instances of the same windows service >In-Reply-To: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset="US-ASCII" > >Yes, then you can set the service name in the registry (or a local >configuration file) from your installer class, since the installer is >aware of the service name. Then your Main() method in the service >itself can retrieve that value from wherever you stored it, and set the >ServiceBase.ServiceName. I do that by passing it into the service >constructor, and setting it there. > > -----Original Message----- > From: dotnet discussion [mailto:[EMAIL PROTECTED]] > On Behalf Of Sorte Per > Sent: Tuesday, February 26, 2002 12:23 PM > To: [EMAIL PROTECTED] > Subject: Re: [DOTNET] Multiple instances of the same windows service > > > I want to install (with installUtil) multiple copies of the > same exe with different ServiceNames that are not hard-coded. > > So far I've passed the ServiceName from the installUtil.exe > via Installer.Context to set the ServiceInstaller.ServiceName. > > What I need is to pass the ServiceName to the Main() of my > service in order to set the ServiceBase.ServiceName. I don't > think it's possible to specify parameters for the service > using installUtil.exe, so I probably have to do the registry > work myself. > -- > Per > This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.