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. Visual Basic
  4. Windows service and dependencies

Windows service and dependencies

Scheduled Pinned Locked Moved Visual Basic
databasequestioncsharpsysadminhelp
5 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
    KreativeKai
    wrote on last edited by
    #1

    I have a windows service that I'm currently writing that will start automatically when the server that it is installed on is rebooted. The service will look up some data on a SQL table and then close the database and continue working without opening SQL again. This should work fine with one exception. What happens if the MSSQLSERVER service hasn't started yet? What is the procedure to add code to my service to create dependencies that MSSQLSERVER has to be running before my service starts? Any help is appreciated. :confused:

    Lost in the vast sea of .NET

    L 1 Reply Last reply
    0
    • K KreativeKai

      I have a windows service that I'm currently writing that will start automatically when the server that it is installed on is rebooted. The service will look up some data on a SQL table and then close the database and continue working without opening SQL again. This should work fine with one exception. What happens if the MSSQLSERVER service hasn't started yet? What is the procedure to add code to my service to create dependencies that MSSQLSERVER has to be running before my service starts? Any help is appreciated. :confused:

      Lost in the vast sea of .NET

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Insted of creating dependencies, can you just check the status of the MSSQLSERVER service and start it if it is not running?

      K 1 Reply Last reply
      0
      • L Lost User

        Insted of creating dependencies, can you just check the status of the MSSQLSERVER service and start it if it is not running?

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

        I thought about that, but I don't want the service to just shut down if it can't find SQL. With dependencies doesn't the server sort of handle the order that it starts everything to make sure a service that depends on another service doesn't get started first? :confused:

        Lost in the vast sea of .NET

        L 1 Reply Last reply
        0
        • K KreativeKai

          I thought about that, but I don't want the service to just shut down if it can't find SQL. With dependencies doesn't the server sort of handle the order that it starts everything to make sure a service that depends on another service doesn't get started first? :confused:

          Lost in the vast sea of .NET

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I'd say you're right. I usually try to take the easy way out. :) Check this out: How to: Code Service Dependencies[^] It appears there is a ServicesDependedOn property on the ServiceInstaller class.

          K 1 Reply Last reply
          0
          • L Lost User

            I'd say you're right. I usually try to take the easy way out. :) Check this out: How to: Code Service Dependencies[^] It appears there is a ServicesDependedOn property on the ServiceInstaller class.

            K Offline
            K Offline
            KreativeKai
            wrote on last edited by
            #5

            It worked perfectly! Thanks! :)

            Lost in the vast sea of .NET

            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