I have a Windows application and want to self-host a WCF in it. This MSDN article walks you through how to self-host WCF in a console. Jason Henderson's article demonstrates how to call the service. But the problem is, I don't want to host my service in another Windows process. I want to host it in my client application.Here is my workaround:CtrlF5 to run the serviceAdd service reference to my clientapplicationThen I can start my service in my client like this:static void Main(){    ServiceHost host = new ServiceHost(typeof(MyService));    host.Open();    Application.Run(new Form1());    host.Close();}It works, but I wonder if there are any simpler ways to do this.
Self-hosting WCF in Windows Forms without another Windows process
c#;winforms;wcf
You can also start host in another thread:Task.Factory.StartNew(() =>    {            ServiceHost host = new ServiceHost(typeof(MyService));            host.Open();    };(or using classic Thread and ThreadStart).