How can I propogate an event in a windows service to the WCF service it is hosting so that the WCF service will raise a callback to the client?

StackOverflow https://stackoverflow.com/questions/5998019

Question

Here is what I want to do:

  1. Have a windows service that hosts a WCF service. This service also will get notifications from SQL Server via SQLDependency.
  2. When the windows service gets notified by SQL Server that something has changed, I want it to initiate a callback to all the clients via the WCF service it is hosting.

Here's what I have so far:

  1. A WCF service that has the callback etc. It works and the clients receive the call back (but so far only if the client sends a message first!).
  2. The windows service hosting the WCF service, and getting the SQLDependency notifications

Here's where I have fallen on my face:

  1. How do I get the windows service to notify the WCF service that it should send the message to the clients?
Was it helpful?

Solution

Create a public method on your WCF service that can be called by your Windows service that will initiate the callback to all the clients. Then add the WCF service reference to your Windows service and it should be easy from there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top