c# - Windows Console App Fails When Run in Task Manager

08
2014-07
  • devedean

    I have a written a .Net console app that scans my Exchange 2007 inbox looking for specific subject text then processes the email body text. It works fine when I launch the app directly but when I set up a scheduled task for the app to run, say, every 10 minutes it crashes (error: "Stopped working") every time when run through taskeng.exe. I've added some console debug statements to see exactly where it fails and it happens right before:

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
    service.AutodiscoverUrl("[email protected]");
    

    After doing some research it sounds like it could be the user account setting in the scheduler general settings.I checked that and it's set to run when I am logged in with my user credentials, which is what I want. I have other console apps scheduled to run at other times and they have no issue (though they are not using ExchangeService). Does anyone have any ideas?

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    Windows XP Task Management: no execution
  • Ice09

    we used the following scenario sucessfully over a long period of time:

    1. Remotely log onto a Win XP server, which is used by one user most/all of time
    2. Schedule a task using the "task planner"
    3. Task was run at "almost" each scheduled point of time (seldom it did not start, presumably when someone else was logged in).

    For some time now, we share the server with several users. Even though I checked an option for running independently of the logged in user, this option does not seem to work. Now, the task is seldom executed, not seldom not executed.

    Now, the question is: is there some other option I can't see which disables the execution OR, even better, is there some other tool which we can use for task scheduling on Win XP servers with several different users?


  • Related Answers
  • Shevek

    First of all, Windows XP is NOT a server operating system!

    Second - you need to look in the Event Logs to find out why it is failing. Look for error events around the time of the schedule.

  • ChrisF

    I'm not 100% sure where the option is on XP (I'm running Windows 7 at the moment), but there's an option that states:

    Start the task only if the computer is idle for: XXX minutes

    Is this option checked?

    There are some additional options about waiting for the computer to become idle and stopping the task if the computer ceases to be idle.

    Make sure these are all set to allow the task to start and continue regardless of whether any user is active or not.