本文介绍了如何在 WCF 服务和宿主应用程序之间进行通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过这个教程.这很好用,这里没有问题.现在我在托管应用程序中托管服务.但同时我想在主机应用程序中使用从客户端到服务的输入.

I created an WCF service through this tutorial. This works great, no problems here.Now I am hosting the service in an Managed Application. But at the same time I would like to used the input from the client to the service in the host application.

我不需要客户端和服务之间的双工通信.我只需要服务和主机通信之间的通信.

I don't need Duplex communication between the Client and the Service. I just need communication between the Service and the Host communication.

处理这个问题的最佳方法是什么?

What would be the best way to deal with this?

推荐答案

我设法使用 问题.其中指出服务类也可以传递给主机.然后就像添加一个事件侦听器来响应来自服务的事件一样简单.

I managed to solve it using the information from this question. In which it was pointed out that service classes can also be passed to the host. Then it is as simple as adding an event listener which responds to events from the Service.

这篇关于如何在 WCF 服务和宿主应用程序之间进行通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-18 11:11