简体   繁体   English

远程控制/调试.NET应用程序的最佳方法是什么?

[英]What is the best method of remotely controlling/debugging a .NET application?

I'm running a VB.NET application 24 hours a day on a dedicated machine. 我在一台专用机器上一天24小时运行VB.NET应用程序。 I'd like to be able to receive status updates and also control/debug the application remotely (ie from another computer via the internet). 我希望能够接收状态更新,并远程控制/调试应用程序(即通过互联网从另一台计算机)。

It would be an advantage if the communication was lightweight (in terms of bytes sent and received) so I can control the thing without needing a fast internet connection. 如果通信是轻量级的(就发送和接收的字节而言)将是一个优势,所以我可以控制事物而无需快速的互联网连接。 Also, I'm running the application from within the IDE at the moment because there are some unhandled exceptions and it's easier to debug this way. 此外,我现在正在IDE中运行应用程序,因为有一些未处理的异常,并且以这种方式调试更容易。 It would be nice if I didn't have to compile it and catch all the errors. 如果我不必编译它并捕获所有错误,那将是很好的。

What is the easiest way to set something like this up, and what do I need to be aware of in terms of security? 设置这样的东西的最简单方法是什么?在安全性方面我需要注意什么?

Any ideas or pointers to further reading would be appreciated. 任何想要或进一步阅读的指示将不胜感激。

Update 更新

To clarify what input I need to give the application - in theory, none. 澄清我需要给应用程序提供什么输入 - 理论上,没有。 If all went to plan I'd just set the application off and reading some sort of log would be fine. 如果一切都按计划进行,我只需关闭应用程序并阅读某种日志即可。 The problem is that it is unstable (mainly because it calls a web service which is very unstable and returns all sorts of weird things) and therefore seems to need constant input on my part. 问题是它不稳定(主要是因为它调用一个非常不稳定的Web服务并返回各种奇怪的东西),因此我似乎需要不断的输入。

It was my thinking that the only way I could do this sort of debugging remotely is by catching every error I could, reading the log, and somehow instructing the application to behave properly in future. 我认为远程调试的唯一方法是捕获每一个错误,读取日志,并以某种方式指示应用程序在将来正常运行。

There are a lot of open ends here, but here are my thoughts: 这里有很多开放的目标,但这是我的想法:

The fact that you are running the application via the IDE to get debugging indicate that you aren't getting enough debugging information when the application dies. 您通过IDE运行应用程序以进行调试这一事实表明您在应用程序死亡时没有获得足够的调试信息。 Look into resolving this before trying to work around it by try/catch -ing on appropriate places, and log relevant info to the EventLog . 在尝试通过try / catch -ing在适当的位置解决它之前,请考虑解决此问题,并将相关信息记录到EventLog The log can then be read from a remote machine . 然后可以从远程计算机读取日志。

For monitoring and controlling remotely, it is really hard to tell what is the simplest solution without more information about your app. 对于远程监控和控制,如果没有关于您的应用的更多信息,很难说什么是最简单的解决方案。 What needs to be done via the interface, what access constraints do you have,...? 需要通过界面做什么,你有什么访问限制,......?

Based on the limited information, I'd suggest writing a small web application to control your app - either embedded in the application or as a small service controlling it by some other means. 基于有限的信息,我建议编写一个小型Web应用程序来控制您的应用程序 - 嵌入在应用程序中或作为通过其他方式控制它的小型服务。 This way you benefit from the fact that web techniques and security settings are well known. 这样您就可以从Web技术和安全设置众所周知的事实中受益。

Edit: Judging by your update it seems like you are looking for a remote debugger . 编辑:根据您的更新判断,您似乎正在寻找远程调试器

Hmm... I don't think you need to develop a solution... This sounds like a winapp running on a server. 嗯......我认为你不需要开发解决方案......这听起来像是在服务器上运行的winapp。

Did you consider installing teamviewer on the target machine, or simply using Windows RDC? 您是否考虑在目标计算机上安装teamviewer,或者只是使用Windows RDC?

If you are using a logging framework like log4net or nlog you (which you should if you do logging) you can easily use a remote appender. 如果您正在使用log4net或nlog等日志记录框架(如果进行日志记录,则应该使用),您可以轻松使用远程appender。 log4net for example provides a remote appender which sends log entries via tcp to a remote server where you can write a small watchdog type app to monitor your system. 例如,log4net提供了一个远程appender,它通过tcp将日志条目发送到远程服务器,您可以在其中编写一个小型监视器类型的应用程序来监视您的系统。

If you need a simpler solution you can use an email appender which mails all errors to you. 如果您需要更简单的解决方案,可以使用电子邮件附加程序将所有错误邮寄给您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM