惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 浅水滩

VSTS FAQ 配置Team Build的每日构建 WORD 2007向博客园发布BLOG 一不小心删除了“Team Foundation Licensed Users”组中的用户后的恢复 我猜到了开始,却没有猜到结局 --深叹2006足球世界杯决赛 有感于“快乐地消灭软件工业” 蜗牛的家 Google的秘密 -- 《Google成功的七堂课》读后感 NHibernate的关键点精要 NHibernate 0.9 发布了 驳:光荣与失落 开发工程师人生之路 Subversion Server For Windows安装指南 NHIBERNATE的几个问题 JUNIT IN Action (1) 将企业应用进行到底 .NET企业应用架构所要解决的若干问题 MAVERICK.NET初窥(原创) 在ASP.NET中解析类似http://abc.com/product?x=1111完全解决方案 Shadowfax 架构(自己翻译)
System.Timers.Timer在Windows Services程序中工作不正常的问题解决
浅水滩 · 2005-01-22 · via 博客园 - 浅水滩

问题:

在windows service程序中,定时器在运行一段时间后不工作

分析:

在查阅了大量的资料后,我们发现导致这个错误的原因是因为.NET FrameworkSystem.Timers.Timerbug导致的。以下是该BUG的简单信息:

BUG: The Elapsed event of the System.Timers.Timer class is not raised in a Windows service

Article ID

:

KB 842793

Last Review

:

July 27, 2004

Revision

:

1.0

SYMPTOMS

You can use the Microsoft .NET Framework to create a new Microsoft Windows service that contains a System.Timers.Timer object. When you run this new Windows service, the Elapsed event of the System.Timers.Timer class may not be raised.

CAUSE

Note In this section, the System.Timers.Timer object is referred to as the Timer object.

In the event handler for the Elapsed event of the Timer object, if you call the Stop method of the Timer object, the reference to the Timer object is lost. The garbage collector then reclaims the memory that is associated with the Timer object. Later, even if you call the Start method of the Timer object to raise the Elapsed event, the call does not work. The Elapsed event is not raised.

WORKAROUND

To work around this problem, use a System.Threading.Timer object instead of the System.Timers.Timer object.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

详见以下链接内容,http://support.microsoft.com/default.aspx?scid=kb;EN-US;842793

解决方案:

按照KB 842793的建议,用System.Threading.Timer替换System.Timers.Timer