title: Windows Form and WCF service
body: <p>I looked around and didn't find exactly what I'm looking for.</p>
  
  <p>I have a windows form and a wcf service in the same project and I host the wcf service withing the form by doing the following:</p>
  
  <pre><code>Application.EnableVisualStyles();
  Application.SetCompatibleTextRenderingDefault(false);
  ServiceHost host = new ServiceHost(typeof(Service1));
  host.Open();
  
  Application.Run(new Form1());
  host.Close();
  </code></pre>
  
  <p>And the application which uses the service has no issues calling it.</p>
  
  <p>My issue is now calling the wcf service's methods within the Windows Form. I could simply do </p>
  
  <pre><code>Service1 service = new Service1();
  service.doWork();
  </code></pre>
  
  <p>But by doing this I'm not using the same instance as the clients of the Service (even if I use InstanceMode.Single) and I want to.</p>
  
  <p>I know I could simply implement the windows form as a GUI Client of the web service (adding a service reference). </p>
  
  <p>But I simply want to have the wcf service hosted in the windows form and access the same service instance as the wcf clients. How can I do that?</p>