Click here to Skip to main content
11,647,170 members (70,366 online)
Click here to Skip to main content
Add your own
alternative version

Dynamically Generate a WCF Proxy

, 8 Jan 2011 CPOL 68.3K 2.3K 44
Save time by using a dynamically generated WCF proxy
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using SharedInterface;

namespace DynamicWcfProxyServer
   class Program
      static void Main(string[] args)
         Server singleServerInstance = new Server();
         Uri baseUri = new Uri(Configuration.CreateServerUriString());
         ServiceHost serviceHost = new ServiceHost(singleServerInstance, baseUri);
         Binding sharedBinding = Configuration.CreateBinding();
         serviceHost.AddServiceEndpoint(typeof(IMessageSender), sharedBinding, baseUri);
         serviceHost.AddServiceEndpoint(typeof(IMessageSenderWithCallBack), sharedBinding, baseUri);
         Console.WriteLine("WCF Server is running.");

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


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


About the Author

Patrick Kalkman
Netherlands Netherlands
Patrick Kalkman is a senior Software Architect with more than 20 years professional development experience. He works for SimpleTechture where he helps teams develop state of the art web applications.

Patrick enjoys writing his blog. It discusses agile software development. Patrick can be reached at

Published Windows 8 apps:

Published Windows Phone apps:


Best Mobile article of March 2012
Best Mobile article of June 2012

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150804.2 | Last Updated 8 Jan 2011
Article Copyright 2010 by Patrick Kalkman
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid