public Form1(){InitializeComponent();ServiceHost host = new ServiceHost(typeof(Service1));host.Open();}
ChannelFactory factory = new ChannelFactory(new WSHttpBinding(), new EndpointAddress("http://localhost:8731/Design_Time_Addresses/WindowsFormsHost/Service1/"));IService1 proxy = factory.CreateChannel();proxy.DoWork();
[STAThread]static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);ServiceHost host = new ServiceHost(typeof(Service1));host.Open();Application.Run(new Form1());}