locked
Two instances of a Windows Service Running RRS feed

  • Question

  • Hello!

    First of all sorry if I haven't posted it in the right place. I did not know where to put it.

    I'm developing a Windows service wich connects to a DB to make some queries. I have installed it right and it works perfectly. My problem is that I would like to have another copy of this Service running in the same machine but opinting to another DB ( a Test DB) and I would like to use the same code so I only change the connectionString to have one or another service compiled. How Can I do that so when I install the service in the same machine it creates another service (for example myServiceTest)??

    Thanks a lot in advance!!!

    Thursday, October 9, 2008 10:35 AM

Answers

  • You'll have to install two services with different names to have two instances of the "same" service running.  I belive the service name in a Visual Studio service project is embedded in the executable; so, as is you'll have to build a new service to do what you want.  With a little bit more work, you can have two services in one project and share most of the code between the two services.
    http://www.peterRitchie.com/blog
    • Marked as answer by jack 321 Monday, October 13, 2008 4:02 AM
    Thursday, October 9, 2008 2:03 PM