ServiceController.ExecuteCommand:如何找回数据 [英] ServiceController.ExecuteCommand: how to get data back

查看:237
本文介绍了ServiceController.ExecuteCommand:如何找回数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在.NET中,的ServiceController 类,您可以使用的ExecuteCommand 方法来发送自定义命令到服务

In .NET, the ServiceController class allows you to send a custom command to a service using the ExecuteCommand method.

我希望能够查询服务的状态(状态自定义的概念,而不是启动/停止品种)。我希望这将是简单的使用类似于的ExecuteCommand 东西打电话到服务,并得到一个返回值,指示状态。有什么在的ServiceController 这将使我能够做到这一点?

I would like to be able to query the service for its status (a custom notion of status, not the 'Started/Stopped' variety). I was hoping it would be straightforward to make a call to the service using something similar to ExecuteCommand and get a return value indicating the status. Is there something in ServiceController that would enable me to do this?

假如不是这样,我想我必须使用某种外部的进程间通信技术(如服务写入其状态的数据库,或者到消息队列)。你会推荐简单?

Assuming not, I guess I have to use some kind of external inter-process communication technique (e.g. service writes its status to a database, or to a message queue). What would you recommend for simplicity?

推荐答案

当然是有没有的ServiceController 办法。离开WCF为presumably的最佳选择。教程在这里:的http://www.switchonthe$c$c.com/tutorials/wcf-tutorial-basic-interprocess-communication

There certainly isn't a way in ServiceController. Leaving WCF as presumably the best option. Tutorials here: http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication

这篇关于ServiceController.ExecuteCommand:如何找回数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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