我有一个Windows Form应用程序,我们刚刚将它作为服务添加到Windows Server 2016服务器上。应用启动时,它将启动60秒计时器。在启动时,每隔60秒滴答运行一次,该应用就会运行并运行一个作业,并向数据库报告。
当我启动服务时,负载栏速度达到50%,然后缓慢蠕变几秒钟,然后我收到“错误1053:服务没有及时响应启动或控制请求”。我所见过的大多数情况都涉及到发生错误,但是在服务放弃运行之前,我的应用程序似乎运行良好。有提示吗?
它获得的代码非常简单(删去了无关的位)
Private Sub Me_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Call GoRun()
End Sub
Private Sub GoRun()
If Not TimerToUpdate.Enabled Then
TimerToUpdate.Interval = 60000
TimerToUpdate.Enabled = True
UpdateRunning = True
Try
Call RunUpdate() '''<< This is the job, which it gets through fine
Catch ex As Exception
End Try
UpdateRunning = False
End If
End Sub
Private Sub UpdateTimer_Elapsed(source As Object, e As EventArgs) Handles TimerToUpdate.Tick
If Not UpdateRunning Then
UpdateRunning = True
Try
Call RunUpdate()
Catch ex As Exception
End Try
UpdateRunning = False
End If
End Sub