Spawning Process Never Finishes on ASP.NET Page
- by Nissan Fan
The code below spawns the process and sits forever, never finishing. It doesn't matter what process I run. If I use delegates it doesn't work either. It just hangs up in my dev and on the test enviornment. Also, if I use Shell with Wait it does the same thing. If I set wait to false in either approach it works just fine. It's ASP.NET 2.0 VB.NET DotNetNuke 4.0 on Windows Server 2003. I can't even phathom why this would hang up.
UPDATE: It causes the CPU to throttle up but it's not running anything. It's like there's something weird going on in the threading.
From: http://www.freevbcode.com/ShowCode.asp?ID=5879
Public Sub ShellandWait(ByVal ProcessPath As String)
Dim objProcess As System.Diagnostics.Process
objProcess = New System.Diagnostics.Process()
objProcess.StartInfo.FileName = ProcessPath
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
objProcess.Start()
'Wait until the process passes back an exit code
objProcess.WaitForExit()
'Free resources associated with this process
objProcess.Close()
End Sub