什么是看门狗桌面应用程序的最佳方法是什么? [英] What's the best way to watchdog a desktop application?

查看:166
本文介绍了什么是看门狗桌面应用程序的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些方法来监视桌面应用程序,并重新启动它,如果它死了。

起初,我认为最好的方法是监测/从一个Windows服务重新启动该进程,直到我发现,由于Vista的<一个href="http://social.msdn.microsoft.com/Forums/en-US/windowssdk/thread/f8f91e8f-5954-43a7-8bc4-80ed2ff1e3b1">Windows服务不应该与桌面交互

我已经看到了解决这一问题的几个问题,但每一个答案,我已经看到涉及到某种黑客由Microsoft气馁,将可能停止在未来操作系统的更新工作。

因此​​,Windows服务可能不是一种选择了。我很可能只是创建一个不同的桌面/控制台应用程序要做到这一点,但那种失败的目的。

这将是最优雅的方式来做到这一点,在您看来?

编辑:这是没有恶意,也没有病毒需要监控的应用程序是一个媒体播放器将运行在嵌入式系统上,即使我试图覆盖所有可能的碰撞情况下,我不能冒险让它崩溃了一个意外的错误(S **吨发生)。这种看门狗会的情况下一切只是一个保障出错。此外,由于玩家会显示第三方Flash内容,一个额外的加将是例子,如果说监控资源使用情况,并重新启动播放器,一些蹩脚的Flash影片开始的内存泄漏。

编辑2:我忘了提,在应用程序,我想监视/重启拥有的完全没有必要以在任LocalSystem帐户,也没有任何管理权限在所有运行。其实,我的 preFER 它使用当前登录的用户凭据运行。

解决方案
  

起初,我认为最好的方法是监测/从一个Windows服务重新启动该进程...

当然可以! 我有时前做到了。 你可以开始学习如何看这样的:

<一个href="http://msdn.microsoft.com/en-us/windows7trainingcourse_win7session0isolation_topic2#_Toc243675529" rel="nofollow">http://msdn.microsoft.com/en-us/windows7trainingcourse_win7session0isolation_topic2#_Toc243675529

和这样的:

http://www.$c$cproject.com/Articles/18367/Launch-your-application-in-Vista-under-the-local-s

在物质,你要运行程序的系统,但与当前用户的会话ID。

如果你感觉懒惰,我想可能会有一些好一点的服务,让你在寻找的东西。尝试搜索 WWW。codeproject.com

I need some way to monitor a desktop application and restart it if it dies.

Initially I assumed the best way would be to monitor/restart the process from a Windows service, until I found out that since Vista Windows services should not interact with the desktop

I've seen several questions dealing with this issue, but every answer I've seen involved some kind of hack that is discouraged by Microsoft and will likely stop working in future OS updates.

So, a Windows service is probably not an option anymore. I could probably just create a different desktop/console application to do this, but that kind of defeats its purpose.

Which would be the most elegant way to achieve this, in your opinion?

EDIT: This is neither malware nor virus. The app that needs monitoring is a media player that will run on an embedded system, and even though I'm trying to cover all possible crash scenarios, I can't risk having it crash over an unexpected error (s**t happens). This watchdog would be just a safeguard in case everything else goes wrong. Also, since the player would be showing 3rd party flash content, an added plus would be for example to monitor for resource usage, and restart the player if say, some crappy flash movie starts leaking memory.

EDIT 2: I forgot to mention, the application I would like to monitor/restart has absolutely no need to run on either the LocalSystem account nor with any administrative privileges at all. Actually, I'd prefer it to run using the currently logged user credentials.

解决方案

Initially I assumed the best way would be to monitor/restart the process from a Windows service...

Sure you can! I did it some times ago. You can start learning how watching this:

http://msdn.microsoft.com/en-us/windows7trainingcourse_win7session0isolation_topic2#_Toc243675529

and this:

http://www.codeproject.com/Articles/18367/Launch-your-application-in-Vista-under-the-local-s

In substance, you have to run programs as SYSTEM, but with the SessionID of the current user.

If you're feeling lazy, I suppose there could be some good little Services which make the thing you're looking for. Try searching on www.codeproject.com.

这篇关于什么是看门狗桌面应用程序的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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