在系统重新启动时自动重新启动聊天服务器应用程序
我开发了一个带有聊天服务器的聊天应用程序。 一切正常。 现在的问题是,每当聊天服务器出现故障时(例如,服务器系统由于电源故障或其他问题而关闭),当服务器系统重新启动时,聊天服务器必须手动重新启动。
我相信(并且我知道)当计算机重新启动时,聊天服务器应用程序自行重新启动更为合适(当然,无论谁登录,甚至在任何人登录之前)。 我有一个执行聊天服务器的批处理文件。 我的尝试是创建一个自动启动的 Windows 服务,并使用服务器系统上的网络服务帐户运行此批处理文件。 虽然,我(暂时)遇到了困难,但我很想问是否有使用 Windows 服务的替代方法。 非常感谢您的建议。
I developed a chat application with an attendant chat server. Everything is working fine. The issue now is the fact that whenever the chat server goes down (for instance, the server system shuts down as a result of power failure or some other problem), by the time the server system come back on, the chat server would have to be restarted manually.
I believe (and I know) it is more appropriate for the chat server application to restart itself when the computer comes back on (and of course regardless of who is logged in and of course, even before anyone logs in). I have a batch file that executes the chat server. My attempt was to create a windows service that start automatically and runs this batch file using a Network Service account on the server system. Although, I'm having a hard time with this (temporarily), I would love to ask if there are any alternatives to using a windows service. Suggestions are highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
创建 Windows 服务将是更好的解决方案,但您可以将批处理文件添加到启动文件夹中。
Creating a windows service will be the better solution, but you can add your batch file into the startup folder.
我认为您已经有了更好的解决方案(Wibndows Service)。 在服务器重新启动时添加电子邮件警报或某种警报会很方便(?)。
I think you are already having the better solution (Wibndows Service). Along with adding an email alert or some sort of alert when the server restarts will be handy (?).
我可能会使用 Windows 任务计划程序启动服务器。 您可以设置任务在系统启动时启动:
I would probably just start the server using the Windows Task Scheduler. You can set a task to start on system startup: