Scheduled Task will not run returns e0434f4d as last result
I have a simple vb.net application. When I go to bin\debug\program.exe and double click the program runs perfect. The same program will not execute using task scheduler. When I create a scheduled task and click 'run' it just pops up 开发者_开发知识库a console window for a second, closes. Additionally, this same program used to run with task scheduler. One day, it just stopped working.
ps:
I have this program code managed in svn so I can safely say that the code has not changed.The 0xe0434f4d exit code is quite meaningful. That's the native exception code for a managed exception. In other words, your app is crashing with an unhandled exception when it is run by task manager. I could guess at reasons why, but it is fairly pointless. Find out yourself, write an event handler for AppDomain.CurrentDomain.UnhandledException and log the value of e.ExceptionObject.ToString(). That gives you the exception message and the stack trace, almost always good enough to find out why it is bombing.
Personally I don't believe in magic :-)
- Double-check that the source code is not modified comparing to the working version.
- Are you sure that the program is executed at all? Might be some permissions-related issues (from which user does the program execute and so on).
- (if #2 passes) Try debugging it to see what causes the problem.
Actually, this problem was caused by permissions. As a scheduled task the job did not have permissions to certain folders and files.
I would check to see what user the scheduled task is running under. It maybe that is running with an account whose password has expired (as you said it has been running previously) and requires this to be changed.
One thing I have noticed with certain scheduled tasks on Windows 2000 and Windows XP is that every time the machine is rebooted, we have to re-enter the password on some of the tasks. Others continue to work without it, and I never identified the difference.
精彩评论