Performance Counter.Net bug

在windows services开发中,碰到一个奇怪的问题:

有时可以启动,有时启动超时,经过漫长的分析(有引用其它的组件),发现问题出在Performance counter的创建上,sometimes, the code will be hang here.

Link:

http://www.pcreview.co.uk/forums/strange-performance-counter-performance-problem-windows-service-application-t2781664.html

解决方法:

将Performance Counter操作放到OnStart方法中,不要放到ServiceBase.Run之前就可以.

.Net 的Bug也真是不少啊

原文地址:https://www.cnblogs.com/DataFlow/p/2272882.html