Solved

WCF: Server to Client

Posted on 2009-05-02
3
486 Views
Last Modified: 2013-11-08
I want to write a windows service and install it on about 15 computers spread throughout different states.  I also have a separate web server that is located in Texas.  The windows service on each computer should do a specific task when instructed by the Web server.  The clients with teh windows services can't take this action based on polling (such as polling every 5 minutes to the web server) because what the clients have to do is sensitive down to the second.

I would like to know if this is possible.  I know that I can have the windows service on each client contact the web server and query it or ask it a question, but can the webserver contact a specific client, sent it an xml string and expect a return answer?  again, the client (windows services) can't poll the web server...it has to be done the other way around.

Any help is appreciated, if you can get me pointed in the right direction I would greatly appreciate it!
0
Comment
Question by:volumeIII
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24290110
In your scenario, the Client is not the Windows service, the client is the WebServer. So the windows service on computers would have to act as a server listening on may be tcp/ip ports for incoming webserver requests, processing them, and reply to the webserver.
0
 
LVL 11

Accepted Solution

by:
CMYScott earned 500 total points
ID: 24297613
We are working thru this same scenario right now on our project.  The answer is "yes" it can be done.  I've gotten it to work using CallbackContract in WCF which required a bi-directional communication method (I'm using wsDualHttp right now).  For performance reasons, I'm trying to use netTcp bindings and struggling a bit.

I think this is the link to one of my main sources of example for creating my callback implementation (there are others as well if you google 'wcf callback')

http://dotnetaddict.dotnetdevelopersjournal.com/wcf_alarmclock.htm

Essentially, you have to support a subscribe/unsubscribe method in your WCF Service as well as an Interface for a callback method.  That interface needs to be implemented in your client class as well.  When the client subscribes, it passes a context to the implementation of the callback method.  Whenever your service needs to notify clients of events, it loops thru the collection of subscribers and raises the callback method on the client via the context that was passed during the subscription event.

Good Luck,
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question