title: ProcessStartInfo WaitForExit Timeout
body: <p>I need to print a pdf-file with <code>ProcessStartInfo</code>.</p>
  
  <pre><code> string docInvoicePath = @"[Path]";
   string printername = "\"PRN-OFFICE\"";
   string driver = "\"Xerox Global Print Driver PS\""; 
   string port = "\"[IP]\"";
  
   ProcessStartInfo psInfo = new ProcessStartInfo
   {
       FileName = @"""C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32""",
       Arguments = String.Format("/s /o /h /t " + docInvoicePath + " " + printername + " " + driver + " " + port),
       Verb = "print",
       WindowStyle = ProcessWindowStyle.Hidden,
       CreateNoWindow = true,
       UseShellExecute = false                 
   };
  
   Process process = Process.Start(psInfo);
   process.WaitForExit(6000);
   if (process.HasExited == false)
   {
       process.Kill();
   }
   process.Close();
  </code></pre>
  
  <p>The <code>filename</code> and <code>arguments</code> are correct they work when pasted in <code>cmd</code>.
  The code works properly but after <code>Process.Start</code> when it comes to <code>WaitForExit</code> the programm doesn`t finish. I get the timeout error:</p>
  
  <blockquote>
    <p>System.Threading.ThreadAbortException: Thread was being aborted.
        at System.Threading.WaitHandle.WaitOneNative(SafeHandle waitableSafeHandle, UInt32 millisecondsTimeout, Boolean
    hasThreadAffinity, Boolean exitContext)
         at System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean
    hasThreadAffinity, Boolean exitContext)
        at System.Diagnostics.Process.WaitForExit(Int32 milliseconds)...</p>
  </blockquote>
  
  <p>I searched and try a few things like setting <code>&lt;httpRuntime executionTimeout="300"/&gt;</code> and run into a <strong>500</strong> or like in the code with <code>process.WaitForExit(6000);</code> and higher ther where no exeption but nothing got printed.</p>
  
  <p>Is there an error or am i missing something?</p>
  
  <p><strong>EDIT:</strong>
  I changed my codeblock above. Now the code works in debug mode but it still won´t print my document when published. I also tried to use a different User.
  In debug mode the code prints the document but runs in the <em>kill</em> query.</p>
  
  <p>The <code>ProcessStartInfo.Verbs</code> returns a  <strong>Argument Exception</strong> but i don´t know why.</p>