Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Windows Service : More than one user Service running within the same process

Windows Service : More than one user Service running within the same process

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Krugger404
    wrote on last edited by
    #1

    Hi, I am working on a windows service that monitor a path and does some upload based on the FileWatcher class. As per microsoft, it say that "More than one user Service may run within the same process". Therefore, i created two services (component classes) in my windows service project and added an instance of each to the service to run as shown below: static void Main() { ServiceUtility initUtl = new ServiceUtility(Constants System.ServiceProcess.ServiceBase[] ServicesToRun; **ServicesToRun = new System.ServiceProcess.ServiceBase[] { new exchangeRateFileWatcher(), new KYCFileWatcher() };**System.ServiceProcess.ServiceBase.Run(ServicesToRun); } However, i read that the second service will run only if the first one fails. Can you please tell me whether it is possible (and how) to run the two services within the same process (i.e exe)? Thank you for your kind help

    Carpe diem, Krg

    P V 2 Replies Last reply
    0
    • K Krugger404

      Hi, I am working on a windows service that monitor a path and does some upload based on the FileWatcher class. As per microsoft, it say that "More than one user Service may run within the same process". Therefore, i created two services (component classes) in my windows service project and added an instance of each to the service to run as shown below: static void Main() { ServiceUtility initUtl = new ServiceUtility(Constants System.ServiceProcess.ServiceBase[] ServicesToRun; **ServicesToRun = new System.ServiceProcess.ServiceBase[] { new exchangeRateFileWatcher(), new KYCFileWatcher() };**System.ServiceProcess.ServiceBase.Run(ServicesToRun); } However, i read that the second service will run only if the first one fails. Can you please tell me whether it is possible (and how) to run the two services within the same process (i.e exe)? Thank you for your kind help

      Carpe diem, Krg

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      datastruct wrote:

      i read that the second service will run only if the first one fails

      That's nonsense. I have service processes running up to eight Services.

      1 Reply Last reply
      0
      • K Krugger404

        Hi, I am working on a windows service that monitor a path and does some upload based on the FileWatcher class. As per microsoft, it say that "More than one user Service may run within the same process". Therefore, i created two services (component classes) in my windows service project and added an instance of each to the service to run as shown below: static void Main() { ServiceUtility initUtl = new ServiceUtility(Constants System.ServiceProcess.ServiceBase[] ServicesToRun; **ServicesToRun = new System.ServiceProcess.ServiceBase[] { new exchangeRateFileWatcher(), new KYCFileWatcher() };**System.ServiceProcess.ServiceBase.Run(ServicesToRun); } However, i read that the second service will run only if the first one fails. Can you please tell me whether it is possible (and how) to run the two services within the same process (i.e exe)? Thank you for your kind help

        Carpe diem, Krg

        V Offline
        V Offline
        vikas amin
        wrote on last edited by
        #3

        To start multiple services you have to call the SCM multiple times say by the Services applet . Check out this link . http://forums.msdn.microsoft.com/en-US/csharpgeneral/thread/a062b1e8-7425-4ba9-b038-a5973fd2150d[^]

        Vikas Amin

        My First Article on CP" Virtual Serail Port "[^]

        modified on Thursday, July 24, 2008 5:33 PM

        K 1 Reply Last reply
        0
        • V vikas amin

          To start multiple services you have to call the SCM multiple times say by the Services applet . Check out this link . http://forums.msdn.microsoft.com/en-US/csharpgeneral/thread/a062b1e8-7425-4ba9-b038-a5973fd2150d[^]

          Vikas Amin

          My First Article on CP" Virtual Serail Port "[^]

          modified on Thursday, July 24, 2008 5:33 PM

          K Offline
          K Offline
          Krugger404
          wrote on last edited by
          #4

          Thanks for your kind help Vikas :-) I'll see into it now itself

          Carpe diem, Krg

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups