Solved

WCF: Server to Client

Posted on 2009-05-02
3
487 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

756 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