Windows服务,时间间隔为15分钟 [英] windows service with time interval as 15 mins
本文介绍了Windows服务,时间间隔为15分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个Windows服务,其时间间隔为15分钟
但是它在第一次运行时就没有执行这项工作.每次启动服务时,我都必须等到15分钟.
有任何想法吗?
Hi,
I ve created a windows service with time interval as 15 mins
but its not performing the job on its first run. I have to wait till 15 minutes each time i start the service .
any ideas?
推荐答案
仅在第一次启动服务时调用事件处理程序.
Just call the Event handler the first time when you start the service.
您一定已经使用过一些timer_tick事件中的逻辑.我建议您将所有这些移至私人功能.然后,当应用程序启动时,在启动计时器之前以及在timer_tick中调用此函数.所以我们的工作是第一次完成,然后计时器会处理它.
You must have used some logic in timer_tick event. i suggest you move all that to a private fucntion. then when application start call this function before starting timer and also in timer_tick. so our work is done first time and then the timer will take care of it.
这篇关于Windows服务,时间间隔为15分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文