Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7195589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:36:29+00:00 2026-05-28T20:36:29+00:00

I have a windows service containing this code: public static void ExtractTextInner(string source, string

  • 0

I have a windows service containing this code:

    public static void ExtractTextInner(string source, string destination)
    {   
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.FileName = EXTRACTOR_EXE_FILEPATH
        startInfo.Arguments = "\"" + source + "\" \"" + destination + "\"";
        startInfo.CreateNoWindow = true;
        startInfo.WindowStyle = ProcessWindowStyle.Hidden;

        Process process = new Process();
        process.StartInfo = startInfo;

        process.Start();
        process.WaitForExit();
        int exitCode = process.ExitCode;
        process.Close();
        if (exitCode != 0)
        {
            switch (exitCode)
            {
                case 1:
                throw new ApplicationException("IFilter Extraction Failed");
                default:
                throw new ApplicationException("Unknown Exit Code:" + exitCode.ToString());
            }
        }
    }

The purpose of this code is run an IFilter extract on a document, we use a seperate process because some IFilters are notoriously flaky.

Now this code runs perfectly fine on Windows 7 and Server 2008 R2 boxes but on a Windows Server 2003 the WaitForExit immediately throws a “There is no process associated with this Process object” exception. The process does exist and completes its task without a problem.

Anyone seen this? Can anyone shed any light on why WaitForExit would thow this error?

Additional Info

If I place this code in a Console App and run it works fine on the Windws Server 2003 box as well, hence it would appear to be a specific problem running this in a Service on a Windows Server 2003 box.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:36:30+00:00Added an answer on May 28, 2026 at 8:36 pm

    When starting processes, with the System.Diagnostics.Process class, the system can either use CreateProcess or ShellExecuteEx Win32 function. When using CreateProcess only executable files can be started. When using ShellExecuteEx, any file which can be started using the “Start->Run” command from the shell.

    However these are completely different ways of starting processes. ShellExecuteEx involves the shell, and can, for example, re-use an existing instance of Word or Excel to open a document, by using the information stored under the HKCR\<progid>\shell\<verb> registry key. This may involve for example using DDE to search for and then activate an existing Excel instance.

    See documentation on ShellExecuteEx‘s SHELLEXECUTEINFO:

    • http://msdn.microsoft.com/en-us/library/windows/desktop/bb759784(v=vs.85).aspx

    Note that ShellExecuteEx may or may not return an hProcess depending on whether a new process was started. This is the behavior which you are seeing.

    CreateProcess is a lower-level function and creates a process directly, and simply passes the equivalent arguments. It always returns a process handle.

    Note: Since you seem to be starting an executable file, it is a bit surprising that no hProcess is returned by ShellExecuteEx. Nevertheless, if you want to ensure you get a process handle, using UseShellExecute = false is the correct thing to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a windows service that runs various system monitoring operations. However, when running
We have a Windows Service written in C#. The service spawns a thread that
I have a windows service connecting to a SqlServer database on the local box.
I have a Windows Service written in Delphi which runs a number of programs.
I have a windows service I am trying to debug. Is it a bad
I have a windows service that runs fine, but I have to have it
I have a windows service written in C# that acts as a proxy for
I have a Windows service that runs implementations of a framework across multiple threads.
I have a windows service that has a custom configuration section. In the configSectionHandler
I have a Windows Service project, A, with a dependency on a class library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.