用.NET创建Windows服务__教程 |
|
日期:2007-5-20 0:36:51 人气:98 [大 中 小] |
|
|
|
// Component Designer. InitializeComponent(); } // The main entry point for the process static void Main() { System.ServiceProcess.ServiceBase[] ServicesToRun; ServicesToRun = new System.ServiceProcess.ServiceBase[] { new MyService() }; System.ServiceProcess.ServiceBase.Run(ServicesToRun); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.timer1 = new System.Timers.Timer(); ((System.ComponentModel.ISupportInitialize) (this.timer1)).BeginInit(); // // timer1 // this.timer1.Interval = 30000; this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed); // // MyService // this.ServiceName = "My Sample Service"; ((System.ComponentModel.ISupportInitialize) (this.timer1)).EndInit(); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } /// /// Set things in motion so your service can do its work. |
|
出处:本站原创 作者:佚名 |
|
|