Windows Service每2分钟查询一次数据库 [英] Windows Service to query the database every 2 minutes

查看:185
本文介绍了Windows Service每2分钟查询一次数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想创建一个Windows服务,每2分钟查询一次数据库.我使用了Visual Studio 2005 IDE.
请给我建议一些解决方案.

谢谢

Hi
I want to create a windows service that query the database for every 2 minutes.I used the Visual studio 2005 IDE.
please suggest me some solution.

Thank you

推荐答案

请参见MSDN中的Timer类........
See the Timer class in MSDN....................


您需要创建一个服务应用程序并进行安装,为此需要一个服务安装程序(包含在您的应用程序中),以搜索创建系统服务vb.net.

参见此处

您不必使用计时器组件,而需要使用线程计时器,因为服务上的计时器组件将无法使用,

system.threading.timer
You need to create a service application, and have it install, for which you need a service installer, included in your application, Search for creating a system service vb.net.

See here

Instead of using a timer component you need to use a threading timer because the timer component on the service will not work,

system.threading.timer


您已经确定了解决方案-创建Windows服务.继续并进行编码.
You''ve already identified the solution - create a windows service. Go forth and code.


这篇关于Windows Service每2分钟查询一次数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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