473,761 Members | 7,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to install 2 times the same Service?

Hi,

I developped a Windows Service in VB.NET (2005).

I need to have it installed two times on 1 machine. When I want to install
it a second time, the setup doesn't allow me to install it again in an other
directory, but only to repair or remove the other version.

I get arround this by simply copying the files of the first installed in a
second directory.

But when I want to install the second service (so it would come in the
Services-list in the config panel) I can't do this, even if I rename it...

I should have somewhere the ability to change the name of a service at the
inside: somehow with a configfile that is read. I tried this using the
ServiceInstalle r_BeforeInstall-event (in the ProjectInstalle r), but it
doesn't seem to work...

Anybody any idea?

Thanks a lot in advance,

Pieter
Nov 22 '05 #1
4 8168
Try changing ProductCode.
"DraguVaso" <pi**********@h otmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi,

I developped a Windows Service in VB.NET (2005).

I need to have it installed two times on 1 machine. When I want to install
it a second time, the setup doesn't allow me to install it again in an
other
directory, but only to repair or remove the other version.

I get arround this by simply copying the files of the first installed in a
second directory.

But when I want to install the second service (so it would come in the
Services-list in the config panel) I can't do this, even if I rename it...

I should have somewhere the ability to change the name of a service at the
inside: somehow with a configfile that is read. I tried this using the
ServiceInstalle r_BeforeInstall-event (in the ProjectInstalle r), but it
doesn't seem to work...

Anybody any idea?

Thanks a lot in advance,

Pieter


Nov 22 '05 #2
Pieter,
Short answer you can't.

Long answer: To install the service twice you would need to change:
1. The ServiceBase.Ser viceName property of your service itself.
2. The ServiceInstalle r.ServiceName property on the ServiceInstalle r object
on your ProjectInstalle r
3. Possibly any custom Performance Counters & Event Logs...

Do you always want to install 2 instances of the service or just
occasionally install 2 instances?

What I would normally do define 2 services in my assembly. The first
MyService1 inherits from System.ServiceP rocess.ServiceB ase and has all the
logic for both services. The Second MyService2 inherits from MyService1 and
changes the ServiceName property, plus overrides any custom Performance
Counters or Event Logs.

Then in my ProjectInstalle r I would have 2 ServiceInstalle r objects, one for
MyService1 & one for MyService2. Also in the Project Installer would be any
duplicate custom Performance Counters & Event Logs...

The "problem" is if both services are in a single EXE, then both are going
to be installed. If I wanted to optionally install one or both I would
define 2 EXEs and a DLL. The DLL would have MyServiceBase that inherits from
System.ServiceP rocess.ServiceB ase and has all the logic for both services.
The first EXE would have MyService1 inherits from MyServiceBase and changes
the ServiceName property, plus overrides any custom Performance Counters or
Event Logs. The second EXE would have MyService2 inherits from MyServiceBase
and changes the ServiceName property, plus overrides any custom Performance
Counters or Event Logs.

Alternatively you might (*might*) be able to use Dynamic Properties in the
designer to set both of the ServiceName properties, however I want to say
the ProjectInstalle r is dynamically loaded under a different program, so it
won't find your app.config with the dynamic properties.

A third alternative might be to pass the service name as a CustomActionDat a
from the Setup project... This might be useful with the second
alternatively.. .

Hope this helps
Jay

"DraguVaso" <pi**********@h otmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi,

I developped a Windows Service in VB.NET (2005).

I need to have it installed two times on 1 machine. When I want to install
it a second time, the setup doesn't allow me to install it again in an
other
directory, but only to repair or remove the other version.

I get arround this by simply copying the files of the first installed in a
second directory.

But when I want to install the second service (so it would come in the
Services-list in the config panel) I can't do this, even if I rename it...

I should have somewhere the ability to change the name of a service at the
inside: somehow with a configfile that is read. I tried this using the
ServiceInstalle r_BeforeInstall-event (in the ProjectInstalle r), but it
doesn't seem to work...

Anybody any idea?

Thanks a lot in advance,

Pieter

Nov 22 '05 #3
Hi,

Thanks a lot alreaddy for the answer.
Where do I find the ServiceBase.Ser viceName-property? I can't find it
somewhere?

And should I change these in the ServiceInstalle r1_BeforeInstal l event?

The fact is: sometimes I have to isntall the Service only one time,
sometimes 2, sometimes 3 or four times :) It depends on the number of
COM-ports on the computer...

Pieter

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:ee******** ******@TK2MSFTN GP09.phx.gbl...
Pieter,
Short answer you can't.

Long answer: To install the service twice you would need to change:
1. The ServiceBase.Ser viceName property of your service itself.
2. The ServiceInstalle r.ServiceName property on the ServiceInstalle r object on your ProjectInstalle r
3. Possibly any custom Performance Counters & Event Logs...

Do you always want to install 2 instances of the service or just
occasionally install 2 instances?

What I would normally do define 2 services in my assembly. The first
MyService1 inherits from System.ServiceP rocess.ServiceB ase and has all the
logic for both services. The Second MyService2 inherits from MyService1 and changes the ServiceName property, plus overrides any custom Performance
Counters or Event Logs.

Then in my ProjectInstalle r I would have 2 ServiceInstalle r objects, one for MyService1 & one for MyService2. Also in the Project Installer would be any duplicate custom Performance Counters & Event Logs...

The "problem" is if both services are in a single EXE, then both are going
to be installed. If I wanted to optionally install one or both I would
define 2 EXEs and a DLL. The DLL would have MyServiceBase that inherits from System.ServiceP rocess.ServiceB ase and has all the logic for both services.
The first EXE would have MyService1 inherits from MyServiceBase and changes the ServiceName property, plus overrides any custom Performance Counters or Event Logs. The second EXE would have MyService2 inherits from MyServiceBase and changes the ServiceName property, plus overrides any custom Performance Counters or Event Logs.

Alternatively you might (*might*) be able to use Dynamic Properties in the
designer to set both of the ServiceName properties, however I want to say
the ProjectInstalle r is dynamically loaded under a different program, so it won't find your app.config with the dynamic properties.

A third alternative might be to pass the service name as a CustomActionDat a from the Setup project... This might be useful with the second
alternatively.. .

Hope this helps
Jay

"DraguVaso" <pi**********@h otmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi,

I developped a Windows Service in VB.NET (2005).

I need to have it installed two times on 1 machine. When I want to install it a second time, the setup doesn't allow me to install it again in an
other
directory, but only to repair or remove the other version.

I get arround this by simply copying the files of the first installed in a second directory.

But when I want to install the second service (so it would come in the
Services-list in the config panel) I can't do this, even if I rename it...
I should have somewhere the ability to change the name of a service at the inside: somehow with a configfile that is read. I tried this using the
ServiceInstalle r_BeforeInstall-event (in the ProjectInstalle r), but it
doesn't seem to work...

Anybody any idea?

Thanks a lot in advance,

Pieter


Nov 22 '05 #4
Pieter,
Where do I find the ServiceBase.Ser viceName-property? I can't find it
somewhere? Normally you set it in the properties when you have the designer of the
Service itself open.
And should I change these in the ServiceInstalle r1_BeforeInstal l event? ServiceBase.Ser viceName cannot be changed in the ServiceInstalle r per se, it
is a property of the service when the service runs.

The fact is: sometimes I have to isntall the Service only one time,
sometimes 2, sometimes 3 or four times :) It depends on the number of
COM-ports on the computer...
Rather then have a service for each COM-port I would probably create a
single service. Then that single service would have a single thread (or
group of threads) for each com port.

Hope this helps
Jay

"DraguVaso" <pi**********@h otmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. Hi,

Thanks a lot alreaddy for the answer.
Where do I find the ServiceBase.Ser viceName-property? I can't find it
somewhere?

And should I change these in the ServiceInstalle r1_BeforeInstal l event?

The fact is: sometimes I have to isntall the Service only one time,
sometimes 2, sometimes 3 or four times :) It depends on the number of
COM-ports on the computer...

Pieter

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
news:ee******** ******@TK2MSFTN GP09.phx.gbl...
Pieter,
Short answer you can't.

Long answer: To install the service twice you would need to change:
1. The ServiceBase.Ser viceName property of your service itself.
2. The ServiceInstalle r.ServiceName property on the ServiceInstalle r

object
on your ProjectInstalle r
3. Possibly any custom Performance Counters & Event Logs...

Do you always want to install 2 instances of the service or just
occasionally install 2 instances?

What I would normally do define 2 services in my assembly. The first
MyService1 inherits from System.ServiceP rocess.ServiceB ase and has all
the
logic for both services. The Second MyService2 inherits from MyService1

and
changes the ServiceName property, plus overrides any custom Performance
Counters or Event Logs.

Then in my ProjectInstalle r I would have 2 ServiceInstalle r objects, one

for
MyService1 & one for MyService2. Also in the Project Installer would be

any
duplicate custom Performance Counters & Event Logs...

The "problem" is if both services are in a single EXE, then both are
going
to be installed. If I wanted to optionally install one or both I would
define 2 EXEs and a DLL. The DLL would have MyServiceBase that inherits

from
System.ServiceP rocess.ServiceB ase and has all the logic for both
services.
The first EXE would have MyService1 inherits from MyServiceBase and

changes
the ServiceName property, plus overrides any custom Performance Counters

or
Event Logs. The second EXE would have MyService2 inherits from

MyServiceBase
and changes the ServiceName property, plus overrides any custom

Performance
Counters or Event Logs.

Alternatively you might (*might*) be able to use Dynamic Properties in
the
designer to set both of the ServiceName properties, however I want to say
the ProjectInstalle r is dynamically loaded under a different program, so

it
won't find your app.config with the dynamic properties.

A third alternative might be to pass the service name as a

CustomActionDat a
from the Setup project... This might be useful with the second
alternatively.. .

Hope this helps
Jay

"DraguVaso" <pi**********@h otmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
> Hi,
>
> I developped a Windows Service in VB.NET (2005).
>
> I need to have it installed two times on 1 machine. When I want to install > it a second time, the setup doesn't allow me to install it again in an
> other
> directory, but only to repair or remove the other version.
>
> I get arround this by simply copying the files of the first installed
> in a > second directory.
>
> But when I want to install the second service (so it would come in the
> Services-list in the config panel) I can't do this, even if I rename it... >
> I should have somewhere the ability to change the name of a service at the > inside: somehow with a configfile that is read. I tried this using the
> ServiceInstalle r_BeforeInstall-event (in the ProjectInstalle r), but it
> doesn't seem to work...
>
> Anybody any idea?
>
> Thanks a lot in advance,
>
> Pieter
>
>



Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1643
by: MarkM | last post by:
Hi there. Since upgrading to XP SP2 on my development box, I now compile the same windows service code and try to install it on a Windows 2000 server. Throws error "Access Is Denied". The installer then backs out and says the "The installer was interrupted before the service could be installed". I have installed this same service on this same server over 30 times in the last year. Does XP SP2 add extra security to the .NET windows...
4
386
by: DraguVaso | last post by:
Hi, I developped a Windows Service in VB.NET (2005). I need to have it installed two times on 1 machine. When I want to install it a second time, the setup doesn't allow me to install it again in an other directory, but only to repair or remove the other version. I get arround this by simply copying the files of the first installed in a second directory.
3
57001
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I want to test this service on a Windows Server 2003 box that doesn't have the Visual Studio Command prompt. How do I go about installing the service on the Windows Server 2003 box? Thanks!
2
7987
by: Fan Wang | last post by:
Hi All, I wrote a windows service with C# as below. But I can't install it with installutil.exe. I got an error message " Exception occurred while initializing the installation: System.IO.FileNotFoundException: File or assembly name windowsservice1, or one of its dependencies, was not found.. " I am new to C# environment. Any idea any clue will be appreciated. Thanks using System;
2
2034
by: | last post by:
i run the following: installutil "my service.exe" and it goes through and tells me the install and commit were successful. i go to the services list and it isn't shown. i've done this multiple times before with other projects and it won't work. if i try to do net start "my
2
6092
by: John | last post by:
Hi I have a vb.net service app which I have set to run as user. When I try to install the service via InstallUtil, I provide user/pass for the administrator but the service fails to install. I have received the following two messages on two separate occasions; An exception occurred during the Install phase. System.ComponentModel.Win32Exception: No mapping between account names and security IDs was done
6
2164
by: Jean-Marc Blaise | last post by:
Hi, How can I make MSSQL2K5 setup install everything in the install path I have choosen - it keeps installing some files in ¨%SystemRoot% ? Thanks, JM
4
3181
by: kkt49 | last post by:
# vim: et sw=4 ts=8 sts from wxPython.wx import * import sys, os, time import pywintypes import win32serviceutil import win32service import win32event import win32process
12
1591
by: Matt Fielder | last post by:
I tried to install SP1, and it appears to have just stopped somewhere part way through. It was "collecting information" (for a long time, slow progress bar) --- then suddenly it stopped.... no indication that either something went wrong, it completed, or still running in the background. I let it sit for another 30 minutes in case it was chugging along with no UI, which I didn't think likely without as cpu usage stayed near zero as did...
1
3384
by: kataoki | last post by:
Hi, This is the log file for my SP1 on 2005 install. Can anyone please look at this and tell me if this looks normal? I'm concerned about the following in the log: "Failed to read registry key: Debug" AND all the entries that show "- Not Applied"
0
9531
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.