问题描述
下面是premise:
Here is the premise:
我有我需要能够启动和停止的应用程序桌面,但不能远程访问。我脑子里想的是机器,这将启动/停止应用程序的列表作为对上设置的服务。新的命令本窗口服务将定期极Web服务,并相应地执行它们。
I have a desktop that I need to be able to start up and stop applications on, but cannot get remote access to. What I had in mind is setting up a service on the machine that will start/stop a list of applications as told. This windows service will periodically pole a web service for new commands and execute them accordingly.
这些是我的问题。
1),这是最简单的解决方案吗?还有什么建议?
1) Is this the easiest solution? What else would you recommend?
2)有多难运行从Windows服务的exe文件?如何制止呢?
2) How hard is it to run an exe from a windows service? How about stopping one?
这是不是一个项目或任何东西,只是一些我感兴趣的实施(主要是为了好玩)。任何答案,甚至思想是AP preciated。一般性讨论也欢迎(随意留下意见)。
This isn't for a project or anything, just something I am interested in implementing (mostly for fun). Any answers or even thoughts are appreciated. General discussion is also welcome (feel free to leave comments).
推荐答案
作为创建Windows服务本身在C#中,看到我的文章here.
As for creating the Windows service itself in C#, see my post here.
的轮询机制的工作,但在一般情况下,我preFER事件驱动过程,而不是轮询过程。你没有提什么版本的.NET的你使用,但如果是.NET 3.0 / 3.5,我建议使用WCF。当命令被发布到Web服务,Web服务可以将命令发送到Windows服务来执行。 pretty的简单。 Juval洛伊,编程WCF服务的作者,提供了一堆WCF例子/这是免费的在他的网站使用一库>。
The polling mechanism would work, but in general, I prefer event-driven processes instead of polling processes. You didn't mention what version of .NET you were using, but if it is .NET 3.0/3.5, I would suggest using WCF. When the command is posted to the web service, the web service could send the command to the Windows service to be executed. Pretty straightforward. Juval Lowy, the author of Programming WCF Services, offers a bunch of WCF examples/libraries that are free to use at his website.
这篇关于Windows服务应用程序控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!