title: code after servicehost.open method not executing
body: <p>i am learning wcf and working on a sample example. in this, i built a dll for wcf service and 2 windows applications for hosting the service and another client appn. in hosting appn, i cant get to execute the code after servicehost.open method. i am just curious to know whats going on. please help.  </p>
  
  <p>The code in the hosting appn is as below:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Windows.Forms;
  using System.ServiceModel;
  using System.ServiceModel.Description;
  using WCFService;
  namespace WCFServiceHost
  {
      public partial class Form1 : Form
      {
          ServiceHost sh = null;
          public Form1()
          {
              InitializeComponent();
          }
          private void Form1_Load(object sender, EventArgs e)
          {
              Uri tcpa = new Uri("net.tcp://localhost:8000/TcpBinding");
  
              sh = new ServiceHost(typeof(ServiceClass), tcpa);
              NetTcpBinding tcpb = new NetTcpBinding();
              ServiceMetadataBehavior mBehave = new ServiceMetadataBehavior();
              sh.Description.Behaviors.Add(mBehave);
              sh.AddServiceEndpoint(typeof(IMetadataExchange),
              MetadataExchangeBindings.CreateMexTcpBinding(), "mex");
              sh.AddServiceEndpoint(typeof(IServiceClass), tcpb, tcpa);
              sh.Open();
  **//This line is not executed
              label1.Text = "Service Running";
  //This line is not executed**
          }
          private void Form1_FormClosing(object sender, FormClosingEventArgs e)
          {
              sh.Close();
          }
      }
  }
  </code></pre>
  
  <p>one more help: how can we add service reference in visual studio 2005.</p>