I'm using VB.NET to develop a web app that can execute some .exe files (created by me) that will run on the server and continue running until the end of the operation.
Occasionally, the exe file becomes "stuck" and I can't do anything but kill it from the Task Manager on the server.
The thing is, before executing another exe file, I check if there is one already running and I prevent a possible "double" execution of the same program so users can end up waiting for a very long time.
I use this to run the exe:
ProgrammaDaEseguire = Server.MapPath("/Batch") & "\my_program.exe"
Public Function RunSchedulatore(ByVal ProgrammaDaEseguire As String,
ByVal IdSchedulatore As Integer) As Boolean
Try
Dim Proc As System.Diagnostics.Process = New System.Diagnostics.Process()
Proc.StartInfo.FileName = ProgrammaDaEseguire
Proc.StartInfo.Arguments = IdSchedulatore
Proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
Proc.StartInfo.UseShellExecute = False
Proc.Start()
RunSchedulatore = True
Catch ex As Exception
writeLog
RunSchedulatore = False
End Try
End Function
Is there any way I can kill this process that is running on the server?
I'm able to kill the process running on my client, but I'm not sure I can kill the process on the server side.