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 suspend and continue option

windows service suspend and continue option

Scheduled Pinned Locked Moved C#
questionworkspace
12 Posts 5 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.
  • F fracalifa

    Hi!, where do I configure the option that my windows service can be suspended and continued and not only started and stopped ? (I meen that the options are shown and selectable in the service list menue). Is it a code option or a setup option ? Thanks Frank

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

    I haven't had a need to do that and I can't imagine needing it. Why do you want to do it?

    F E 2 Replies Last reply
    0
    • P PIEBALDconsult

      I haven't had a need to do that and I can't imagine needing it. Why do you want to do it?

      F Offline
      F Offline
      fracalifa
      wrote on last edited by
      #3

      Hi, that's not the question. If you examine the service list you will find some services which have these options and some have not. In my case it make sense to suspend the service do something with the data and after this to continue the service. So, please where is the option to be set ? Thanks Frank

      P 1 Reply Last reply
      0
      • F fracalifa

        Hi!, where do I configure the option that my windows service can be suspended and continued and not only started and stopped ? (I meen that the options are shown and selectable in the service list menue). Is it a code option or a setup option ? Thanks Frank

        C Offline
        C Offline
        Calla
        wrote on last edited by
        #4

        I believe ServiceBase has a property called CanPauseAndContinue. Set it to true and then override the OnPause and OnContinue methods.

        F 1 Reply Last reply
        0
        • C Calla

          I believe ServiceBase has a property called CanPauseAndContinue. Set it to true and then override the OnPause and OnContinue methods.

          F Offline
          F Offline
          fracalifa
          wrote on last edited by
          #5

          Hi Calla, that sounds good. Thanks Frank

          C 1 Reply Last reply
          0
          • F fracalifa

            Hi Calla, that sounds good. Thanks Frank

            C Offline
            C Offline
            Calla
            wrote on last edited by
            #6

            You're welcome! :)

            1 Reply Last reply
            0
            • P PIEBALDconsult

              I haven't had a need to do that and I can't imagine needing it. Why do you want to do it?

              E Offline
              E Offline
              Electron Shepherd
              wrote on last edited by
              #7

              PIEBALDconsult wrote:

              Why do you want to do it?

              Possibly to allow existing processing to terminate cleanly, and prevent some new processing, while still running other background processing.

              Server and Network Monitoring

              P 1 Reply Last reply
              0
              • F fracalifa

                Hi, that's not the question. If you examine the service list you will find some services which have these options and some have not. In my case it make sense to suspend the service do something with the data and after this to continue the service. So, please where is the option to be set ? Thanks Frank

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

                But why not just stop and start?

                1 Reply Last reply
                0
                • E Electron Shepherd

                  PIEBALDconsult wrote:

                  Why do you want to do it?

                  Possibly to allow existing processing to terminate cleanly, and prevent some new processing, while still running other background processing.

                  Server and Network Monitoring

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

                  Electron Shepherd wrote:

                  allow existing processing to terminate cleanly

                  Stop should do that as well.

                  Electron Shepherd wrote:

                  while still running other background processing.

                  Then it's not paused, is it?

                  Electron Shepherd wrote:

                  other background processing

                  Possibly should be in its own Service.

                  E 1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    Electron Shepherd wrote:

                    allow existing processing to terminate cleanly

                    Stop should do that as well.

                    Electron Shepherd wrote:

                    while still running other background processing.

                    Then it's not paused, is it?

                    Electron Shepherd wrote:

                    other background processing

                    Possibly should be in its own Service.

                    E Offline
                    E Offline
                    Electron Shepherd
                    wrote on last edited by
                    #10

                    A good example would be a web server implementing Keep-Alive. You may need to prevent new inbound connections, possibly for load balancing or other resource allocation requirements, but preserve the internal state data. Dont forget that just because you've never needed to do it doesn't mean no-one ever needs to do it.

                    Server and Network Monitoring

                    J 1 Reply Last reply
                    0
                    • E Electron Shepherd

                      A good example would be a web server implementing Keep-Alive. You may need to prevent new inbound connections, possibly for load balancing or other resource allocation requirements, but preserve the internal state data. Dont forget that just because you've never needed to do it doesn't mean no-one ever needs to do it.

                      Server and Network Monitoring

                      J Offline
                      J Offline
                      jschell
                      wrote on last edited by
                      #11

                      Electron Shepherd wrote:

                      A good example would be a web server implementing Keep-Alive. You may need to prevent new inbound connections, possibly for load balancing or other resource allocation requirements, but preserve the internal state data.

                      And you are suggesting that you would not do that when stopping as well?

                      Electron Shepherd wrote:

                      Dont forget that just because you've never needed to do it doesn't mean no-one ever needs to do it.

                      Don't forget that just because someone wants to do something it means that it is a good idea. Or even that it will solve their real problem.

                      E 1 Reply Last reply
                      0
                      • J jschell

                        Electron Shepherd wrote:

                        A good example would be a web server implementing Keep-Alive. You may need to prevent new inbound connections, possibly for load balancing or other resource allocation requirements, but preserve the internal state data.

                        And you are suggesting that you would not do that when stopping as well?

                        Electron Shepherd wrote:

                        Dont forget that just because you've never needed to do it doesn't mean no-one ever needs to do it.

                        Don't forget that just because someone wants to do something it means that it is a good idea. Or even that it will solve their real problem.

                        E Offline
                        E Offline
                        Electron Shepherd
                        wrote on last edited by
                        #12

                        jschell wrote:

                        And you are suggesting that you would not do that when stopping as well?

                        Yes, becuase in my specific example, the internal state is related to a TCP connection, so maintaining and restoring the state across a stop / start event is meaninglesss.

                        jschell wrote:

                        Don't forget that just because someone wants to do something it means that it is a good idea.

                        True. My reply was directed at the person who said (very unhelpfully in my opinion) "I haven't had a need to do that and I can't imagine needing it."

                        Server and Network Monitoring

                        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