如何在Windows服务中托管可执行文件? [英] How to host executable in windows service?

查看:111
本文介绍了如何在Windows服务中托管可执行文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我创建了一个控制台应用程序,有一些ref dll。



如何在Windows服务中托管可执行文件(控制台应用程序exe)?





Happy Holi .......... :)

Hi All

I have created one console application,having some ref dll.

How to host executable (Console application exe) in windows service?


Happy Holi.......... :)

推荐答案

以下是三个建议:



1.更新您的控制台应用程序,以便它可以作为一项服务。 (最好)



2.创建一个通用的Windows服务,执行你的控制台应用程序,如果它崩溃等就重新启动它。(不太好)



3.忘记Windows服务并使用任务计划程序在Windows启动时启动控制台应用程序。我已经将这个用于黑客解决方案。您可以将其配置为在Windows启动时启动,无需任何人登录,它将跨越用户会话,您可以将其配置为在失败时重新启动。最终结果与Windows服务非常相似,但显然它不会出现在SCM中,你可以'停止/启动/暂停等等。(简单!)
Here are three suggestions:

1. Update your console app so that it can run as a service. (Best)

2. Create a generic Windows Service which executes your console app and restarts it if it crashes etc. (Not so good)

3. Forget about Windows services and use the task scheduler to start your console app when Windows starts. I've used this a lot for hackier solutions. You can configure it to start up when Windows does, without the need for anyone to log on, it will span user sessions and you can configure it to restart if it fails. The end result is very similar to a Windows Service although obviously it won't appear in the SCM and you can' stop/start/pause it etc. (EASY!)


你不能主持Windows服务中的Windows可执行文件。

将应用程序转换为服务。
You cannot host a windows executable in a windows service.
Convert the application to a service.


这篇关于如何在Windows服务中托管可执行文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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