我需要在事件中停止服务。我通过ftp发送文件,并且ftp响应在文本文件中生成。 所以我正在检查文本文件中的响应,如果出现failoure消息,那么我需要停止service.But,因为这不是一个例外,所以我无法调用OnStart方法来停止服务。 如何在课堂上停止服务?
Dim text As String = "Error: Could not open connection"
Dim lines() As String = Filter(System.IO.File.ReadAllLines(SFtpLogFullPath), text)
If UBound(lines) = -1 Then
'MsgBox("not found")
Else
'MsgBox("found")
Dim UpdFailFTPStatus As New AseCommand("update tb_kamp_filesprocess set FileFTPStatus = '" & "" & "' where FILENAME = '" & fileName & "' ", _SQLConnection)
recordsAffected = UpdFailFTPStatus.ExecuteNonQuery()
ExecuteSP("ml_test_kamp")
writelog("Error occured during SFTP ")
'Need to stop the service here
Exit Sub
End If