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

Installing several instances of an app as services

P: n/a
Hi all,

at the moment i am developing an app which is sort of an interface to
copy data from one database to another and it shall run as a service.
As there are several databases the app must be installed and run in
multiple instances with the configuration data (database, login, etc.)
stored in an app.config file.

Up to now I was concerned with Windows CE apps only so both running an
app as service and running multiple instances of an app is new to me. I
figured out how to create and install a single service app, but now I
don't know how to "multiply" it. I imagine that every app must have its
proper name, so do I have to compile as many instances of my app with
different names as I will need? Or is there a way to "configure" my
single app in a way that I can run it more than once, each being an own
service for windows? And how could I manage the setup then, because
Microsoft's service app sample only shows serveral instances running as
one service, but every instance must be a service of its own.

Any help is appreciated, thanks!

Regards
Roland
Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Roland,

As a suggestion, would it not be better to have a multithreaded application?

There would be one config file (or registry hive etc), containing your
different configurations. When the service starts, it would first load the
config into a queue, then create N threads (where N is the number of
databases you want to read from). Each thread would then take the next
configuration block of the queue, and process to copy that database.

This would mean that you could easily stop and start the threads via a
global "running" flag which you simply set to false. Similarly, starting the
process would kick off all the threads to do your work.

It would be one application, installed at one location, running as one
process with many threads.

If you need more help with ideas for implementing this, let me know.

hope that helps and good luck.

Daniel.

"Roland Riess" <ce******@gmx.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all,

at the moment i am developing an app which is sort of an interface to copy
data from one database to another and it shall run as a service.
As there are several databases the app must be installed and run in
multiple instances with the configuration data (database, login, etc.)
stored in an app.config file.

Up to now I was concerned with Windows CE apps only so both running an app
as service and running multiple instances of an app is new to me. I
figured out how to create and install a single service app, but now I
don't know how to "multiply" it. I imagine that every app must have its
proper name, so do I have to compile as many instances of my app with
different names as I will need? Or is there a way to "configure" my single
app in a way that I can run it more than once, each being an own service
for windows? And how could I manage the setup then, because Microsoft's
service app sample only shows serveral instances running as one service,
but every instance must be a service of its own.

Any help is appreciated, thanks!

Regards
Roland

Nov 16 '05 #2

P: n/a
Hi Daniel,

I don't know why but your answer reached me only now, more than one day
later (as well as my own post in this newsgroup, by the way).

Thanks for your reply, but the "design" of several independent services
is a customer request, so I have no choice - even if your solution was
rather convincing to me!

Regards
Roland
Dan Bass schrieb:
Roland,

As a suggestion, would it not be better to have a multithreaded application?

There would be one config file (or registry hive etc), containing your
different configurations. When the service starts, it would first load the
config into a queue, then create N threads (where N is the number of
databases you want to read from). Each thread would then take the next
configuration block of the queue, and process to copy that database.

This would mean that you could easily stop and start the threads via a
global "running" flag which you simply set to false. Similarly, starting the
process would kick off all the threads to do your work.

It would be one application, installed at one location, running as one
process with many threads.

If you need more help with ideas for implementing this, let me know.

hope that helps and good luck.

Daniel.

"Roland Riess" <ce******@gmx.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all,

at the moment i am developing an app which is sort of an interface to copy
data from one database to another and it shall run as a service.
As there are several databases the app must be installed and run in
multiple instances with the configuration data (database, login, etc.)
stored in an app.config file.

Up to now I was concerned with Windows CE apps only so both running an app
as service and running multiple instances of an app is new to me. I
figured out how to create and install a single service app, but now I
don't know how to "multiply" it. I imagine that every app must have its
proper name, so do I have to compile as many instances of my app with
different names as I will need? Or is there a way to "configure" my single
app in a way that I can run it more than once, each being an own service
for windows? And how could I manage the setup then, because Microsoft's
service app sample only shows serveral instances running as one service,
but every instance must be a service of its own.

Any help is appreciated, thanks!

Regards
Roland


Nov 16 '05 #3

P: n/a

Hmm, it's not really a desirable windows operation. Another tier that
resides with a different company in a project I'm working on tried this and
it proved more a hassle than it was worth.

Still, it can be done with only one service install. You just need to create
N amount of service entries in the registry ( myService1, myService2 etc
etc ) with their own config. Then you need to ensure that the service you're
using isn't accessing any shared global data which could be accessed by
multiple services when you're only expecting one to access it...

I tried these too and there were a few ideas that came up straight away

http://groups.google.co.uk/groups?hl...ows+service%22

http://www.google.co.uk/search?q=run...n&start=0&sa=N

http://www.dotnet247.com/247referenc...48/242835.aspx
good luck!
"Roland Riess" <ce******@gmx.net> wrote in message
news:O0**************@TK2MSFTNGP09.phx.gbl...
Hi Daniel,

I don't know why but your answer reached me only now, more than one day
later (as well as my own post in this newsgroup, by the way).

Thanks for your reply, but the "design" of several independent services is
a customer request, so I have no choice - even if your solution was rather
convincing to me!

Regards
Roland
Dan Bass schrieb:
Roland,

As a suggestion, would it not be better to have a multithreaded
application?

There would be one config file (or registry hive etc), containing your
different configurations. When the service starts, it would first load
the config into a queue, then create N threads (where N is the number of
databases you want to read from). Each thread would then take the next
configuration block of the queue, and process to copy that database.

This would mean that you could easily stop and start the threads via a
global "running" flag which you simply set to false. Similarly, starting
the process would kick off all the threads to do your work.

It would be one application, installed at one location, running as one
process with many threads.

If you need more help with ideas for implementing this, let me know.

hope that helps and good luck.

Daniel.

"Roland Riess" <ce******@gmx.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all,

at the moment i am developing an app which is sort of an interface to
copy data from one database to another and it shall run as a service.
As there are several databases the app must be installed and run in
multiple instances with the configuration data (database, login, etc.)
stored in an app.config file.

Up to now I was concerned with Windows CE apps only so both running an
app as service and running multiple instances of an app is new to me. I
figured out how to create and install a single service app, but now I
don't know how to "multiply" it. I imagine that every app must have its
proper name, so do I have to compile as many instances of my app with
different names as I will need? Or is there a way to "configure" my
single app in a way that I can run it more than once, each being an own
service for windows? And how could I manage the setup then, because
Microsoft's service app sample only shows serveral instances running as
one service, but every instance must be a service of its own.

Any help is appreciated, thanks!

Regards
Roland



Nov 16 '05 #4

P: n/a
Hi Dan,

sorry for the delay but I was busy as I had to finish my "multiple
service" app by today. Finally I opted for a script installation
solution which I found through one of your links. A modified installer
class allows to enter parameters for the setup like service name, user
and password, so that the same code assembly can be used for all
services. The different servers and databases that must be accessed can
be configured by an app.exe.config for each service which may have
identical names as every service is installed in its own directory.

This may not always be a perfect solution but it is just what I need.
Here is the link for everybody that might have the same problem:

http://www.codeproject.com/dotnet/Sc...iceInstall.asp

Thanks again for your help!

Regards
Roland
Dan Bass schrieb:
Hmm, it's not really a desirable windows operation. Another tier that
resides with a different company in a project I'm working on tried this and
it proved more a hassle than it was worth.

Still, it can be done with only one service install. You just need to create
N amount of service entries in the registry ( myService1, myService2 etc
etc ) with their own config. Then you need to ensure that the service you're
using isn't accessing any shared global data which could be accessed by
multiple services when you're only expecting one to access it...

I tried these too and there were a few ideas that came up straight away

http://groups.google.co.uk/groups?hl...ows+service%22

http://www.google.co.uk/search?q=run...n&start=0&sa=N

http://www.dotnet247.com/247referenc...48/242835.aspx
good luck!
"Roland Riess" <ce******@gmx.net> wrote in message
news:O0**************@TK2MSFTNGP09.phx.gbl...
Hi Daniel,

I don't know why but your answer reached me only now, more than one day
later (as well as my own post in this newsgroup, by the way).

Thanks for your reply, but the "design" of several independent services is
a customer request, so I have no choice - even if your solution was rather
convincing to me!

Regards
Roland
Dan Bass schrieb:
Roland,

As a suggestion, would it not be better to have a multithreaded
application?

There would be one config file (or registry hive etc), containing your
different configurations. When the service starts, it would first load
the config into a queue, then create N threads (where N is the number of
databases you want to read from). Each thread would then take the next
configuration block of the queue, and process to copy that database.

This would mean that you could easily stop and start the threads via a
global "running" flag which you simply set to false. Similarly, starting
the process would kick off all the threads to do your work.

It would be one application, installed at one location, running as one
process with many threads.

If you need more help with ideas for implementing this, let me know.

hope that helps and good luck.

Daniel.

"Roland Riess" <ce******@gmx.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl. ..
Hi all,

at the moment i am developing an app which is sort of an interface to
copy data from one database to another and it shall run as a service.
As there are several databases the app must be installed and run in
multiple instances with the configuration data (database, login, etc.)
stored in an app.config file.

Up to now I was concerned with Windows CE apps only so both running an
app as service and running multiple instances of an app is new to me. I
figured out how to create and install a single service app, but now I
don't know how to "multiply" it. I imagine that every app must have its
proper name, so do I have to compile as many instances of my app with
different names as I will need? Or is there a way to "configure" my
single app in a way that I can run it more than once, each being an own
service for windows? And how could I manage the setup then, because
Microsoft's service app sample only shows serveral instances running as
one service, but every instance must be a service of its own.

Any help is appreciated, thanks!

Regards
Roland

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.