using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.ServiceProcess; public class Service1 : System.ServiceProcess.ServiceBase { public Service1() { this.ServiceName = "MyRealService"; } static void Main() { System.ServiceProcess.ServiceBase[] ServicesToRun; ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() }; System.ServiceProcess.ServiceBase.Run(ServicesToRun); } protected override void OnStart(string[] args) { int x = 1; } protected override void OnStop() { } }