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. .NET (Core and Framework)
  4. Windows Service : More than one user Service may run within the same process

Windows Service : More than one user Service may run within the same process

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpquestion
4 Posts 2 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

    S 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

      S Offline
      S Offline
      Scott Dorman
      wrote on last edited by
      #2

      Don't cross post. It's considered rude and isn't going to help you get an answer any faster. While this is the original message, a response has already been posted to the one here[^].

      Scott Dorman

      Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


      Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

      K 1 Reply Last reply
      0
      • S Scott Dorman

        Don't cross post. It's considered rude and isn't going to help you get an answer any faster. While this is the original message, a response has already been posted to the one here[^].

        Scott Dorman

        Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


        Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

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

        Ok scott.Sorry for that.

        Carpe diem, Krg

        S 1 Reply Last reply
        0
        • K Krugger404

          Ok scott.Sorry for that.

          Carpe diem, Krg

          S Offline
          S Offline
          Scott Dorman
          wrote on last edited by
          #4

          datastruct wrote:

          Sorry for that.

          No worries, just letting you know.

          Scott Dorman

          Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


          Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

          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