System.Timer! [英] System.Timer!

查看:92
本文介绍了System.Timer!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我的服务器上运行了Win Svc(.net)。午夜我需要

做一些操作....我怎么能在午夜调用一个计时器?

现在我插入了每个被调用的ElapsedEvent 30

秒里面我检查日期时间是否是午夜......


请提出一些明智的建议!!!

TIA

解决方案

不要使用Windows服务。相反,将其切换到控制台或

windows应用程序,并设置计划任务。


Vai2000写道:


大家好,我的服务器上运行了Win Svc(.net)。午夜我需要

做一些操作....我怎么能在午夜调用一个计时器?

现在我插入了每个被调用的ElapsedEvent 30

秒里面我检查日期时间是否是午夜......


请提出一些明智的建议!!!


TIA


不能做控制台,因为它在dir上进行投票必须是一个svc


" Andy" < an *** @ med-associates.comwrote in message

news:11 ********************* @ l53g2000cwa.googlegro ups.com ...


不要使用Windows服务。相反,将其切换到控制台或

windows应用程序,并设置计划任务。


Vai2000写道:


大家好,我的服务器上运行了Win Svc(.net)。午夜我需要





do一些操作....我怎么能在午夜调用一个计时器?

现在我已经插入了ElapsedEvent,它被称为每个



30


秒里面我检查日期时间是否是午夜......


请提出一些明智的建议!!!

TIA



< blockquote> Vai2000,


我会这样做。我会首先设置一个小计时器(意思是一个小的间隔),然后在这个计时器激活时,我会检查datetime.now

然后设置另一个时间间隔更长的时间,可达到你想要的

所需的时间。使用这种方法,即使服务停止

然后再次重新启动,它也会更正计时器以正确的时间点燃

时间。

-

问候,

Robson Siqueira

企业架构师

" Vai2000" < no **** @ microsoft.comwrote in message

news:eq ************** @ TK2MSFTNGP04.phx.gbl ...


大家好,我的服务器上运行了Win Svc(.net)。在午夜我需要



做一些操作....我怎么能在午夜调用计时器?

现在我已经堵了在ElapsedEvent里面每个人都要打电话给我/ b


秒我在里面检查日期时间是否是午夜......


请提出一些明智的建议!!!


TIA



Hi All, I have a Win Svc (.net) running on my server. At midnight I need to
do some manipulations....how can I invoke a timer at midnight?
Right now I have plugged in the ElapsedEvent which is being called every 30
seconds inside it I check for datetime whether its midnight or not...

Kindly throw some smart suggestions!!!
TIA

解决方案

Don''t use a windows service. Instead, switch it to a console or
windows application, and setup a Scheduled task.

Vai2000 wrote:

Hi All, I have a Win Svc (.net) running on my server. At midnight I need to
do some manipulations....how can I invoke a timer at midnight?
Right now I have plugged in the ElapsedEvent which is being called every 30
seconds inside it I check for datetime whether its midnight or not...

Kindly throw some smart suggestions!!!
TIA


Can''t do console, has to be a svc since its polling on a dir

"Andy" <an***@med-associates.comwrote in message
news:11*********************@l53g2000cwa.googlegro ups.com...

Don''t use a windows service. Instead, switch it to a console or
windows application, and setup a Scheduled task.

Vai2000 wrote:

Hi All, I have a Win Svc (.net) running on my server. At midnight I need

to

do some manipulations....how can I invoke a timer at midnight?
Right now I have plugged in the ElapsedEvent which is being called every

30

seconds inside it I check for datetime whether its midnight or not...

Kindly throw some smart suggestions!!!
TIA



Vai2000,

I would to this. I would set up first a small timer (meaning a small
interval) and then at this timer activation, I would check the datetime.now
and by then set up another time with a bigger interval that would reach the
desired time you want. Using this approach, even that the service is stopped
and then re-started again, it would correct the timer to fire at the right
time.
--
Regards,
Robson Siqueira
Enterprise Architect
"Vai2000" <no****@microsoft.comwrote in message
news:eq**************@TK2MSFTNGP04.phx.gbl...

Hi All, I have a Win Svc (.net) running on my server. At midnight I need
to
do some manipulations....how can I invoke a timer at midnight?
Right now I have plugged in the ElapsedEvent which is being called every
30
seconds inside it I check for datetime whether its midnight or not...

Kindly throw some smart suggestions!!!
TIA



这篇关于System.Timer!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆