Click here to Skip to main content
11,712,727 members (79,438 online)
Click here to Skip to main content

Tagged as

Basic WCF Call + Callback example

, 19 Mar 2012 CPOL 24.1K 3K 10
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 ever since

You may also be interested in...

Comments and Discussions

QuestionThe caller was not authenticated by the service Pin
Member 9505516-Jun-13 22:54
memberMember 9505516-Jun-13 22:54 
This is really a nice example. I installed the service without problems. Running the client it says: "The caller was not authenticated by the service". What is wrong here?
I used VS2010 to build the solutions. Running on Win7-64.
Thanks in advance,
QuestionWorks great! Pin
David Covert21-Oct-12 11:33
memberDavid Covert21-Oct-12 11:33 
Questiondoesnt compile Pin
jnlt25-Sep-12 8:08
memberjnlt25-Sep-12 8:08 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150819.1 | Last Updated 19 Mar 2012
Article Copyright 2012 by javieranton
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid