WCF Async Project

Posted on 2011-10-09
Last Modified: 2012-05-12

I have been asked to develop an application that will allow communication between an existing Winform client application and a web application (CLR 4.0). I am exploring the idea of developing the following WCF based solution but would like to understand if this is feasible. The scope of this question is strictly focused on high-level guidance.

1. Winform

The existing winform app will be re-worked to run inside the taskbar tray (bottom right Win7).

2. Initial WCF Call

Winform app would call WCF service asyncronously and request to be notified if a xml file is copied server side

3. Trigger Winform App

Web app would need to communicate with winform app so web app calls application server side that creates xml file in watched directory.

4. WCF Async Response

WCF service would notify winform with asyncronous response when xml file is finally detected.

5. Winform app responds to web request

Winform app reads and performs tasked defined within the xml file.
Basic questions are is this feasible given that the winform app will load when the Win7 desktop starts and web app requests (in xml file) could be hours apart. I am using .Net CLR 4.0. So can WCF winform client and WCF service work effectively in this scenario? Should an intermediate WCF service layer be required between the IIS WCF service and Backend server app? Note there will be several hundred win/web clients communicating back and forth to. The win/web clients would be running on the same pc and the WCF service will be located across the internet. Each WCF service would simply be setup as a file watch and respond. I am again simply looking for some high-level guidance on this solution and will open other new questions to ask more detailed questions.

As an alternative please advise if this WCF event pattern could also work to establish duplex communication between the web client and the winform client.

Thank you
Question by:jherington
    LVL 28

    Expert Comment

    Everything you have would work fine except for one small consideration: request interruption from the winform to wcf during the asynch call.

    This can be caused by any number of problems.
     - Script timeout on the server
     - Server app pool recycle
     - Client script timeout
     - etc.

    I would recommend one small change. Set the WCF service to reply immediately to a request with whether the file is there or not and then perform a looping call to this service until a file is detected. You can sleep between calls for any length of time for efficiency.

    Author Comment

    Thank you, so then I would continue to use Async WCF calls at both the winform and web clients to check status...correct. The concern I have is the potential delay when the web client makes an initial request; my requirement would be for the winform client to always respond within no more then 5 seconds on an initial request. Is there a way to have the winform client subscribe to an event on the server side or if I setup a looping test for the winform every 5 seconds would that create an inappropriate amount of network traffic (in your opinion)?

    Thank you.
    LVL 28

    Accepted Solution

    If you are looping every 5 seconds and simply receiving a True/False and the XML data if a true is returned, this is minimal network traffic. You'd be looking at less than 1kB for that request when no file exists, essentially a little bit more than a ping.

    Author Closing Comment

    Closing question; is there any solution that would include the winform client subscribing to a server site event which would thereby allow the server to push an async event response back to the client over the web?

    Thank you, your advice has been very helpful!
    LVL 28

    Expert Comment

    Unfortunately there isn't anyway to subscribe to a server event. On the web it is all request/response based and there are limitations there.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now