Note that there are some explanatory texts on larger screens.

plurals
  1. POStarting a process not working in my windows service
    primarykey
    data
    text
    <p>I am trying to execute an exe file through c#.net using a process. It fails to execute returning the following exception:</p> <blockquote> <p>System.InvalidOperationException: No process is associated with this object. at System.Diagnostics.Process.EnsureState(State state) at System.Diagnostics.Process.EnsureState(State state) at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) at System.Diagnostics.Process.WaitForExit(Int32 milliseconds) at System.Diagnostics.Process.WaitForExit() at VideoHandlingWinService.VideoHandlingService.ConvertVideoToFlv(String SavePath, String WithOutExt, String InputFile, String spath, Int32 VideoQueueId) at VideoHandlingWinService.VideoHandlingService.VideoHandling(String VideoName, String SavePath, String InputFile, String WithOutExt, String spath, Int32 VideoQueueId, String VideoDescription, Int32 RegisteredUserId, Int32 CategoryId, String VideoTitle) at VideoHandlingWinService.VideoHandlingService.StartHandlingVideo() at VideoHandlingWinService.VideoHandlingService.OnStart(String[] args)</p> </blockquote> <p>My code to start the process is as follows:</p> <pre><code>Process proc = new Process(); string spath = AppDomain.CurrentDomain.BaseDirectory.ToString(); try { proc.StartInfo.FileName = spath + "\\ffmpeg\\ffmpeg.exe"; proc.StartInfo.Arguments = FilArgs; proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = false; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardError = true; proc.Start(); string StdOutVideo = proc.StandardOutput.ReadToEnd(); string StdErrVideo = proc.StandardError.ReadToEnd(); } catch { } finally { proc.WaitForExit(); proc.Close(); } </code></pre> <p>Any one please tell me how to do this within windows service. Also i am <strong>running the windows service as local account</strong> and hope there is no permission issue for the exe.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload