By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,911 Members | 1,170 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,911 IT Pros & Developers. It's quick & easy.

Multiple Instances of a Service on 1 box

P: n/a
Hi,

I am trying to create a Windows Service in C# that will install on a single box to support multiple environments. I have created the service and it works perfect. Now however, the client has decided to run multiple environments of the application (a web app) on the one box (i.e. production, acceptance & training). The problem is that the service also needs to run in each environment with it's own configuration settings.

I found an article from this newsgroup from Patrick Lam (MAY 2002) that sounded like it was what I needed but couldn't really get it to work. Is there any examples of how I could modify my existing service code so that the name of the service etc is something I can have entered during the installation process and that information is configured dynamically etc so that multiple copies of the service installation exe's are put into seperate directories and therefore can be totally independant of one another. That way the acceptance environment can be updated with the newer version without affecting production and vice versa.

This way I would run the setup package enter a name (e.g. "Production") and get something like:
Processor Service - Production

installed on the box.

I could then run the setup package again, not get told the product is already installed, and enter another name (e.g. "Acceptance") and end up with:
Processor Service - Acceptance
Processor Service - Production

listed in the Services manager.

Effectively what I want to end up with is something very much like SQL Server 2000 where each service can be stopped and configured and upgraded individually. Therefore, I would also need to be able to remove the indivdual services as well if required.

Will try anything at least once.

FYI: I am using VS2002 EA, Framework 1.0 SP2 and the standard included installer solutions.

Thanks,
Mark
Jul 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Mark,

Thanks for posting in the community.

Currently I am looking for somebody who could help you on it. We will reply
here with more information as soon as possible.
If you have any more concerns on it, please feel free to post here.
Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Jul 21 '05 #2

P: n/a
Hi Mark,

Thanks for posting. I have briefly reviewed Patrick Lam's post. I believe
the story is not that simple.

If you would like to use Setup project to deploy the Service, you have to
make use of MSI transform, since we cannot install the same MSI package on
one system multiple times (per machine or for the same user).

http://msdn.microsoft.com/library/de...us/msi/setup/t
ransforms.asp?frame=true

If we take a detailed look on the MSDE setup program, we can find 16 MSI
files. They correspond to the 16 (maximum number) instances of the MSDE.
When we launch the bootstrap EXE ("Setup.exe") the correct MSI is picked
and used.

I hope the information is useful to you.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3

P: n/a
Hi Felix

Thanks for the info. I have read the articles on transformations and completed the samples, but now have some questions

I have created the MNP2000.msi and MNP2000t.msi databases and the associated MNPTrans.mst file by doing the example

http://msdn.microsoft.com/library/de....asp?frame=tru

I have now tried to install this sample to simulate the multiple environments I am going to need for my Windows Service installation, but I have found that the result is I can only effectively install it once. The transformation works and I end up with a slightly different version than using the base database to install the product, but I cannot install both versions at the same time. If I run the installer using the command line

msiexec /i MNP2000.ms

I end up with a default installation of the sample ap

if I then run (as specified in the article)

msiexec /i MNP2000.msi TRANSFORMS=MNPtrans.ms

I do not get the fresh installation screen as I expected but the Repair, Modify, Remove window

I have tried modifying the product name of the package (MNP2000t.msi) and supplied some new guids and this then enabled me to run the separate packages and install it twice, but I couldn't run it applying the transformations to MNP2000t.msi. I am now wondering if I am doing what needs to be done, or am I in fact simply hacking the database and possibly digging myself a very deep hole

Is there any information available on what I am trying to do or what is in the MSDN Library it? Also, the sample relies very heavily on the SDK and the tools assocaited with that (i.e. Orca and MsiInfo), is there a way to do this using the Windows Installer features in the VS IDE? Do third party products like WISE or InstallShield have support for these types of installations

Thanks
Mar

Jul 21 '05 #4

P: n/a
Hi Mark,

Thanks for your feedback. In fact, Transform may be necessary but not
sufficient to achieve the goal.

Transform can change the installation database and tables. However, it
cannot modify the summary information stream. In order to achieve the goal
of multiple installation. We need to change at least 2 things in the MSI,
the product code and the package code. It is likely that we need to change
the upgrade code as well. Through applying a Transform, we can modify the
ProductCode and the UpgradeCode properties in the "Property" table.
However, the PackageCode is stored in the summary information steam, which
is not modifiable solely with Transform.

I would still suggest that we make reference to the MSDE installation
program, which uses 16 separate MSIs. As far as VS.Net Setup project is
concerned, we have the option to package files "As loose uncompressed file"
or "In cabinet files" (in the project property settings). As a result, we
only store the basic database information in the MSIs and we can re-use the
external files for different MSIs.

If you would like to run multilple .Net Windows Services, I think we cannot
hard code the service name in the ServiceInstaller class. Instead, we may
need to read the service name from an external source, so that it is
configurable. The service name is used to identify the service under the
regsitry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servi ces\".

I hope this helps.

Regards,

Felix Wang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.