HowTo: InProc WCF

Well I wrote in the last post about how to make an in-process WCF host.

In this post it is just the keep-it-simple and only about inproc WCF

Get the code her:

The service WcfServiceMan.cs:

using System.ServiceModel; //ServiceContract

    interface IWcfServiceMan
        void DoWork();

    public class WcfServiceMan : IWcfServiceMan
        public void DoWork()
            Console.WriteLine("Inside DoWork()");

The host and client Program.cs:

using ServiceModelEx; //InProcFactory

        static void Main(string[] args)
            Console.WriteLine("*** Server ***");

            IWcfServiceMan svc = null;
                //This one-liner executes the service in its own thread and lets it listen over a named pipe.
                svc = InProcFactory.CreateInstance<WcfServiceMan, IWcfServiceMan>();


                Console.WriteLine("Press <Enter> to terminate the Host application.");
                if (svc != null)

Note: You don’t need anything inside the app.config, which means you don’t need that file! WCF configures itself inside the InProcFactory both to be a service that listens over a named pipe and it delivers a proxy, which can communicate over that pipe. All dynamicly done (without the <system.serviceModel> in app.config).

Source code for IDesign’s InProcFactory can freely be downloaded from:


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: