ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/cpref/html/frlrfsystemmessagingmessagequeueclasssendtopic.htm

解决方案 »

  1.   

    同意 The123(在我地盤這 伱就得聽我的)使用msmq
    http://chs.gotdotnet.com/QuickStart/aspplus/default.aspx?url=%2fquickstart%2fhowto%2fdoc%2fmqsend.aspx
      

  2.   

    写服务的OnCustomCommand方法,传入自定义消息:protected override void OnCustomCommand(int command)
    {
        if(command == 150)//150为自定义的消息,须在128 和 256 之间
        {
            //更改定时器的定时间隔
        }    base.OnCustomCommand (command);
    }
      

  3.   

    我喜欢用配置文件,方法一点,启动后检查配置文件更新时间protected override void OnStart(string[] args)
    {  
    this.timer1_Elapsed(this,null);
    }private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
    try
    {
    //------------ 载入设置文件--------------------------------------------------------------//
    DateTime dateSettings = File.GetLastWriteTime(m_SartUpPath + "\\Settings\\Settings.xml");
                                      //检查配置文件是否在服务启动后更改过
    if(DateTime.Compare(dateSettings,m_SettingsDate) != 0)
    {
    m_pFtpServers.Add(new mh_FTP_Server(m_SartUpPath + "\\Settings\\"));

    m_SettingsDate = dateSettings;
                      /*
    DataSet ds = new DataSet();
    ds.ReadXml(m_SartUpPath + "\\Settings\\Settings.xml"); //---- 获取配置 --------------------------------------//
    foreach(DataRow dr in ds.Tables["Servers"].Rows)
    {
    string ftpRoot = dr["FtpRoot"].ToString();
    if(ftpRoot.EndsWith("\\"))
    {
    ftpRoot = ftpRoot.Substring(0,ftpRoot.Length - 1);
    } string ip   = dr["IP"].ToString();
    int    port = Convert.ToInt32(dr["Port"]); m_pFtpServers.Add(new mh_FTP_Server(ftpRoot,ip,port));
    }*/
    //--------------------------------------------------------//
    }
    }
    catch(Exception x)
    {
    Error.DumpError(x,new System.Diagnostics.StackTrace());
    }
    }