WCF Windows服务交互

发布于 2024-09-13 16:13:40 字数 115 浏览 11 评论 0原文

我有一个 Windows 服务,其中托管一个 WCF 服务。 通过 wcf 服务控制 Windows 服务的最佳方法是什么?我已经为 wcf 服务创建了接口,但我不知道如何与 windows 服务的类和函数进行交互。

I have a windows service in which i host a wcf service.
What is the best approach to control the windows service via the wcf service? I already created the interfaces for the wcf service, but I have no idea how to interact with the windows service's classes and functions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

姜生凉生 2024-09-20 16:13:41

只是为了检查我是否正确理解您的问题 - 您想要运行 wcf 服务,因此您创建一个 Windows 服务来托管它,并且您希望您的桌面客户端能够控制 Windows 服务(即托管 wcf 服务) )通过与 wcf 服务交谈?

如果是这样的话,你想用 Windows 服务做什么?在我完成的一些工作中,我设置了服务器,以便有 Windows 服务托管我想要运行的所有 wcf 服务,并且为了与该 Windows 服务远程交互(例如启动/停止/重新启动) )我有另一个服务在服务器上运行(通常被烘焙到 Amazon 实例映像中,因此它在启动的每个新服务器上运行),我的远程客户端可以与之通信。这样我就可以在所有服务器上触发服务重新启动,而无需手动连接/远程桌面到每个服务器。当然,第二个 wcf 服务通过某种方式受到保护,因此无法轻易被利用。

这是你想做的事情吗?

just to check that I'm understanding your problem correctly - you want to run a wcf service, so you create a windows service to host it, and you want your desktop client to be able to control the windows service (that's hosting the wcf service) by talking to the wcf service?

If that's the case, what is it that you're trying to do with the windows service? In some of the work I've done, I've set up the server such that there's the windows service hosting all the wcf services I want to run, and in order to interact with that windows service remotely (e.g. starting/stopping/restarting) I have another service running on the server (usually baked into the Amazon instance image so it's running on every new server that gets brought up) which my remote client can talk to instead. That way I have a means to trigger a service restart on all my servers without having to manually connect/remote desktop to each server. Of course, the second wcf service is secured by some means so it can't be exploited easily.

Is that the sort of thing you're looking to do?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文