调试通过计划任务启动的应用 [英] Debugging an app launched through scheduled tasks

查看:84
本文介绍了调试通过计划任务启动的应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何调试通过计划任务启动的应用程序?

How do I debug an application which is launched via scheduled tasks?

我有一个简单的应用程序,双击该应用程序即可正常运行,但不能正常运行通过计划的任务启动时可以正常工作。

I have a simple application which works fine when double clicked to launch, but it doesn't work when launched through scheduled tasks.

我知道如何调试本地计算机上的项目,但是如果在本地计算机或其他计算机上运行,​​此应用程序没有问题通过双击可执行文件由用户手动启动。

I know how to debug projects on a local computer, but this application has no issues running on a local computer or on a different computer if launched manually by the user by double clicking the executable file.

我需要一种方法来调试计划任务启动的应用程序。

I need a way to debug the application when it's being launched by scheduled tasks. Is this possible?

推荐答案

我主要建议放置一些不错的日志记录,以便您无需借助调试器即可诊断问题。但是,要启动调试器,可以将其附加到Visual Studio中的现有进程(使用Debug / Attach to process ...菜单),也可以更改代码以包含 Debugger.Launch() 方法其中将启动调试器并将其附加到进程。当然,所有这些都取决于调度程序实际执行的程序。如果调度程序没有执行该程序,则调试器显然无法附加到程序上。

I would primarily suggest putting in some decent logging so that you can diagnose problems without resorting to the debugger. However, to launch the debugger, you can either attach it to an existing process in Visual Studio (using Debug/Attach to process... menu), or change the code to include the Debugger.Launch() method which will launch the debugger and attach it to the process. Of course all of this is dependent on your program actually being executed by the scheduler. If the scheduler doesn't execute the program, then the debugger obviously can't attach to it

这篇关于调试通过计划任务启动的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆