As a first step, I created a Windows service project, set it up correctly, and
In the second step, I added TopShelf Version 3.1.135.0 in my project. If I started my service through (F5 Run), then the top-level console loads and the service is successfully completed.
However, when I run it for installation and run it from the command line, I have a lower TimeOut Error.
Topshelf.Hosts.StartHost Error: 0 : The service failed to start., System.Service Process.TimeoutException: Time out has expired and the operation has not been co mpleted. public class AppService { LoggingService loggingService = new LoggingService(typeof(AppService).Name); public void Start() { loggingService.Info("SampleService is Started"); ExtractProcess.Start(); TransformProcess.Start(); } public void Stop() { loggingService.Info("SampleService is Stopped"); } }
- Updated code to fix this problem.
public void Start() { loggingService.Info("MPS.GOA.ETLService is Started"); ThreadStart myThreadDelegate = new ThreadStart(StartService); Thread myThread = new Thread(myThreadDelegate); myThread.Start(); } private void StartService() { timer.Elapsed += new System.Timers.ElapsedEventHandler(OnElapsedTime); timer.Interval = 60000 * ServiceIntervalInMinutes;
Any suggestions? 
sandeeMPS
source share