.NET Windows Service with timer stops responding

前端 未结 7 980
猫巷女王i
猫巷女王i 2020-11-30 05:17

I have a windows service written in c#. It has a timer inside, which fires some functions on a regular basis. So the skeleton of my service:

public partial cl         


        
7条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-30 05:39

    I have seen this before with both timer, and looped services. Usually the case is that an exception is caught that stops the timer or looping thread, but does not restart it as part of the exception recovery.

    To your other points... I dont think that there is anything "elegant" about the timer. For me its more straight forward to see a looping operation in code than timer methods. But Elegance is subjective.

    Memory issue? Not if you write it properly. Maybe a processor burden if your Thread.Sleep() isn't set right.

提交回复
热议问题