I have a newly minted console app that I have made into a Windows service. I will mention that this code is essentially copied from another windowed program to make it run more efficiently on a server. The code works fine.
This service has a task scheduler built into it, again taken from another console app that runs as a service on the same server. It simply calls a couple of routines that get and put data from two disparate ODBC databases. It does this once a minute.
The new service runs fine but the Services snap-in shows it as Starting, never Running. The original service (on the same server) runs fine and shows as Running within a second of starting.
Here is the Run event code for the App:
' Initialize some things to get us started dim tmrMainLoop as new tmrLoop ' The loop timer must run continuously and fire every second tmrMainLoop.mode = Timer.ModeMultiple tmrMainLoop.Period = 1000 ' Start things off InitService tmrMainLoop.Enabled = True do App.DoEvents loop
This is standard stuff, and the code for the properly running service is essentially the same. InitService reads a few things from a settings file.
I have tried delays in the beginning of the Run handler, as well as in the loop. I know that the code is running properly otherwise because it logs everything it does, including writing a line to the log file every time the timer fires!
I’m using 2018r2.
Any suggestions are welcome. Thanks.