vb.net 计划任务不会运行返回 e0434f4d 作为最后结果

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4648381/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 15:13:39  来源:igfitidea点击:

Scheduled Task will not run returns e0434f4d as last result

vb.netscheduled-tasks

提问by Doug Chamberlain

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.

我有一个简单的 vb.net 应用程序。当我转到 bin\debug\program.exe 并双击该程序运行完美。使用任务调度程序不会执行相同的程序。当我创建一个计划任务并单击“运行”时,它会弹出一个控制台窗口一秒钟,然后关闭。此外,这个相同的程序曾经与任务调度程序一起运行。有一天,它刚刚停止工作。

ps:
I have this program code managed in svn so I can safely say that the code has not changed.

ps:
我在 svn 中管理了这个程序代码,所以我可以肯定地说代码没有改变。

采纳答案by volpav

Personally I don't believe in magic :-)

我个人不相信魔法:-)

  1. Double-check that the source code is not modified comparing to the working version.
  2. 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).
  3. (if #2 passes) Try debugging it to see what causes the problem.
  1. 与工作版本相比,仔细检查源代码是否未修改。
  2. 你确定程序完全执行了吗?可能是一些与权限相关的问题(程序从哪个用户执行等等)。
  3. (如果 #2 通过)尝试调试它以查看导致问题的原因。

回答by Hans Passant

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.

0xe0434f4d 退出代码很有意义。这是托管异常的本机异常代码。换句话说,当您的应用程序由任务管理器运行时,它会因未处理的异常而崩溃。我可以猜出原因,但这毫无意义。找出自己,为 AppDomain.CurrentDomain.UnhandledException 编写一个事件处理程序并记录 e.ExceptionObject.ToString() 的值。这为您提供了异常消息和堆栈跟踪,几乎总是足以找出爆炸的原因。

回答by Doug Chamberlain

Actually, this problem was caused by permissions. As a scheduled task the job did not have permissions to certain folders and files.

实际上,这个问题是由权限引起的。作为计划任务,该作业对某些文件夹和文件没有权限。

回答by WGroleau

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.

我注意到在 Windows 2000 和 Windows XP 上的某些计划任务中,每次重新启动机器时,我们必须重新输入某些任务的密码。其他人在没有它的情况下继续工作,而我从未发现其中的区别。

回答by Dean

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.

我会检查计划任务在哪个用户下运行。它可能正在使用密码已过期的帐户运行(正如您之前所说的那样)并且需要更改此密码。