简体   繁体   中英

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?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM