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?
There is a framework and tutorial available that seems to handle this problem quite nicely WPF Service Host on Codeplex.
EDIT: Updated to illustrate technique created by the WPF Service Host template.
The WPF Service Host is a template for Visual Studio that creates a skeleton application and test client. I'll describe the relevant pieces here.
Here's what the skeleton project looks like:
ClientServiceHost.cs
MainWindow.xaml
MainWindow.xaml.cs
IClientService.cs
ClientService.cs
App.config
And the TestClient, Program.cs:
It is like communication between threads. You need some shared variable with proper locking / synchronization. Your host application will write to this variable and your service will be able to read from that variable.
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.