3-4天后计时器未滴答 [英] Timer Not Ticking after 3-4 days

查看:67
本文介绍了3-4天后计时器未滴答的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我做了一个Windows服务,该服务监视pirticluar db表并在某种情况下触发向用户发送邮件.该服务可以正常工作2,3天,但此后不会触发任何邮件.该服务保持运行状态,并且在事件查看器中也没有关于此服务名称的异常记录,并且该事件不会触发任何邮件.如果我重新启动服务,它将再次正常工作.

有人可以在这里帮助我吗.......

Hi,
I made a windows service that monitors a table of pirticluar db and triggers a mail to user on a condition. The service is working absolutely fine for 2,3 days but after that its not triggering any mail. The service is staying in running state and also there is no exception logged in event viewer on this service name and its not triggering any mails. If i restart the service its again working fine.

Can anyone help me here pls.....

推荐答案

检查您是否正确处理了所有对象-听起来像一些资源(例如SqlCommand,SQlConnection等)未正确释放.如果这不会导致内存问题(并且不会,它们不会占用很多空间),则不会启动GC来调用Dispose以释放对象资源,并且不能使用新的对象资源.创建,直到他们.它可能不只是Sql对象-但我不知道您还使用其他什么对象.
Check that you are correctly disposing all of your objects - it sounds like some resource (such as SqlCommand, SQlConnection etc.) is not being released properly. If this does not cause memory problems (and it won''t, they don''t take a lot of space) then the GC is not kicked in to call Dispose to free up the object resources and new ones can''t be created until they are. It may not be just Sql objects - but I don''t know what others you use.


尝试检查是否已废弃使用的计时器并启用了计时器
try checking that the timer being used hasnt been disposed and that the timer is enabled
protected void checkTimer(Timer t)
{
if (t == null)
{
t = new Timer();
t.Enabled = true;
}
else
{
if (!t.Enabled)
{
t.Enabled = true;
}
else
{
// check the Griffs post on properly disposing objects.
}
}
}


这篇关于3-4天后计时器未滴答的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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