/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (o, e) => log.Error((Exception)e.ExceptionObject); if (Environment.UserInteractive) { var dbis = new DownloadBingImageService(); dbis.Start(args); } else { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new DownloadBingImageService() }; ServiceBase.Run(ServicesToRun); } Thread.Sleep(TimeSpan.FromDays(1)); }