Solved

WCF: Server to Client

Posted on 2009-05-02
3
488 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 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