c# 如何在后台定时调用方法。
haios 2013-04-02 11:08:35 用控制台应用程序写了个定时器,但发布安装后无法使用 。如何才能使程序在后台定时调用一个方法。如一分钟向数据库里插入一条数据。求教各位大神
代码:
public static void Main(string[] args)
{
System.Threading.Timer threadTimer = new System.Threading.Timer(new System.Threading.TimerCallback(getMessage), null, 0, 6000);
}
static void getMessage(Object state)
{
MsgSendBLL bll=new MsgSendBLL();
bll.GetMessage();
}