?
Solved

Multiple concurrent instances of a the same Windows Service on a single server

Posted on 2009-02-20
6
Medium Priority
?
402 Views
Last Modified: 2012-05-06
I have a process that will run as a service.  Each service will monitor a given instance of a machine.  If I have multiple machines, then I need multiple instances of the service to be running concurrently, one service for each machine.  Is it possible in VS2008, .NET 3.5 to change a config somewhere whereby the service will install with a slightly different name (something configurable), and that I can have different DB connection settings, etc, for each service?  
Thanks for any direction,
Larry
0
Comment
Question by:lbrindise
  • 3
  • 3
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 23700173
I don't understand why you would need multiple instances of a Windows service
0
 

Author Comment

by:lbrindise
ID: 23700887
Sorry I wasn't clear.  
I want to have one server monitoring about 100 external devices across the internet.  Because of the synchronous nature of the machines I will be monitoring (they are not computers, rather dumb devices that support a web protocol), there is no way to setup an asynchronous callback architecture.  In other words, the service contacts the device across the internet, and then will wait several seconds for the roundtrip response to come back, and this is a synchronous wait.  Now, if I have 100 of these devices to monitor, there is no way I can have a single service waiting synchronously on each of these 100 devices - there aren't enough seconds in a minute, so-to-speak.  So, I am thinking that if I setup a separate service (a clone of the monitoring routine) for each of these external devices being monitored, then they can each individually be waiting on the synchronous call.  So, there would be 100 windows services, e.g., mon001, mon002, mon003, mon004, with mon001 pointing to device 001, mon002 pointing to device 002, etc.  Lots of services doing lots of synchronous waiting.  I just have to be able to identify each service and point each service to its individually monitored device.
I KNOW IT'S UGLY! :)  I'm open to other suggestions, and hope I'm just missing something obvious.
Thanks!
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 23704995
Would it be possible to distribute the processing, so that you wouldn't have one machine running the service, but a "service farm" of computers that are responsible for a block?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:lbrindise
ID: 23711283
Your question makes me think it might be possible to simply spawn off a new thread for each request, and that way get around the synchronous wait.  However, I'd like to know if it is actually possible to have multiple instances of a service.  Hoping someone can give a definitive answer instead of a workaround (even though a workaround might be plausible).
Thanks
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 23711730
Let's first start with the fact that it is possible to running multiple instances of a single service.

Trick:

Multiple Instance .NET Windows Service
http://www.codeproject.com/KB/dotnet/MultipleInstNetWinService.aspx

This sounds like a very non-standard configuration, and might become a maintenance nightmare, but that would be something to investigate (at least).
0
 

Author Closing Comment

by:lbrindise
ID: 31549306
Thanks for th e link, and the discussion might have given me a better idea to implement the required architecture.  Very interesting.  I wonder why I couldn't find that Codeproject article based on my searching.  Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question