实施恢复模式的策略
我有一个 Windows 应用程序,如果它失败,我想默认为“恢复模式”,即失败后第一次运行它。
我可以标记错误以及用户可以执行的不同操作来恢复,但恢复模式实用程序的实际启动让我头疼。我有几个想法,但我希望其他人能找到更好的方法。
1)当主应用程序加载时,它所做的第一件事是检查以前的错误,然后启动恢复模式实用程序。
这样做的问题是,如果应用程序有任何问题(很可能),那么它根本不会启动。
2) 让用户启动一个实用程序来检查以前的错误,而不是主应用程序,然后启动主应用程序或进入恢复模式。
这解决了第一个想法的问题,但是目标机器非常锁定,并且可能存在部署问题。
还有其他实现恢复模式的策略吗?
谢谢
I have a Windows application which if it fails, I would like to default to a “recovery mode”, the first time it is run after failing.
I'm ok on flagging the error and the different things the user could do to recover, it's the actual launching of the recovery mode utility that is giving me a headache. I have had a couple of ideas, but I was hoping someone else might have come across a better method.
1) When the main app loads the first thing it does if check for a previous error and then launch the recovery mode utility.
The problem with this is that if there is anything wrong with the app, which is likely, then it will not start up at all.
2) Instead of the main app have the user start up a utility that will check for a previous error, then either launch the main app or go into the recovery mode.
This solves the problem with the first idea, however the target machines are very locked down and there could be deployment issues.
Are there any other strategies for implementing a recover mode?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们解决了一些类似的情况,如下所示:
使用 .NET,您甚至可以将两者放入一个 EXE 中...例如使用 ILMerge(免费实用程序)或通过将真实应用程序嵌入为“可嵌入资源”或通过某些商业工具。 ..
这样对于用户没有区别...嵌入式 EXE 可以从内存启动(无需将其提取到文件系统),因此对于用户来说,直到真正需要恢复之前,它没有任何区别...
如果需要有关如何从内存中嵌入和/或启动第二个 EXE 的一些提示,请告诉我 - 我现在手头没有链接,但可以查找它们。
We solved some similar situation as follows :
With .NET you can even put both into one EXE... for example with ILMerge (free utility) or by embedding the real app as an "embeddable resource" or by some commercial tool...
This way for the user there is no difference... and the embedded EXE can be started from memory (no need to extract it to the file system) so for the user it doesn't make any difference until recovery is really needed...
IF need be for some hints on how to embed and/or start the second EXE from memory let me know - I don't have the links at hand right now but could look them up.
问题是,如果应用程序失败,应用程序是否仍然能够记录它失败以及失败的原因?
因此,我会在启动时记录应用程序启动事件,在关闭时记录应用程序关闭事件。然后,如果应用程序在启动时没有找到关闭事件,它可以自动进入恢复模式。
我会直接启动主应用程序,但要非常小心地初始化,以便应用程序不会在启动时崩溃。
The thing is that if the app fails, is the app still capable of recording that it failed and why it failed?
So I would record an app started event on start up and an app closed event on shut down. Then the app could automatically go into recovery mode if it does not find a closed event on start up.
I would go with starting the main app directly, but being very carefull how things are initialised so the app does not crash on startup.