Click here to Skip to main content
13,795,604 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


10 bookmarked
Posted 16 Mar 2012
Licenced CPOL

Basic WCF Call + Callback example

, 19 Mar 2012
Rate this:
Please Sign up or sign in to vote.
A basic WCF call + callback example in C# using WSDualHttpBinding.


Although there are many WCF examples on the web there aren’t many examples that implement both WCF calls and callbacks in a simple way. This article expands on the WCF tutorial Microsoft has on its site ( and adds a simple Callback method. The attached code consists of a Windows Service that hosts the WCF Service and a WindowsForms application that implements the client side.

The Service can be easily installed by clicking on the installService.bat file that comes within the release folder and uninstalled with uninstallService.bat. In addition, it provides logs that can be implemented using the project’s own TraceManager.

The Windows Forms application provides the user with the same WCF calls explained in the cited MSDN tutorial but it also offers the possibility of subscribing the client to the service so the service can perform callbacks on the client.

Tools Used

To edit and compile the code it is required that you use Microsoft Visual Studio 2008 or better. To run the compiled service and application you should only need installed the Microsoft Net Framework 2.0.


The ServiceHost is published through WsDualHttpBinding to support the call and callback channels.

The calls are of course initiated from the client side. The callbacks are initiated from an asynchronous thread on the service side every 10 seconds to all subscribed clients.

The Service project also has a class that serves as a communication bridge for all other processes to ease locking problems. There are many other ways of doing this but this removes the burden of having to place lock statements in several places.


All in all I tried to keep it as simple as possible and implement both calls and callbacks. I developed this for my own use but I hope it can serve to help others as well. Comments and questions are welcome, positive and negative.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer NexTReT S.L.
Spain Spain
Javier graduated from Rochester Institute of Technology in 2010 and has been working as a software developer since then

You may also be interested in...

Comments and Discussions

QuestionThe caller was not authenticated by the service Pin
Member 9505516-Jun-13 23:54
memberMember 9505516-Jun-13 23:54 
QuestionWorks great! Pin
David Covert21-Oct-12 12:33
memberDavid Covert21-Oct-12 12:33 
Questiondoesnt compile Pin
jnlt25-Sep-12 9:08
memberjnlt25-Sep-12 9:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.181207.3 | Last Updated 19 Mar 2012
Article Copyright 2012 by javieranton
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid