private void btn_Close_Click(object sender, EventArgs e) { if (client != null) { Print("Closing a client ..."); client.Close(); client = null; } else { Print("Error! Client does not exist!"); } this.Close(); }
private static void SVInvoke() { //var sv = new ServiceReference1.Service1Client(); //sv.DoWork(); MyServiceClient client = new MyServiceClient(); client.DoWork(); client.Close(); //MyService2Client client = new MyService2Client(); //client.DoWork(); //var channelFactory = new ChannelFactory<IMyService>("WSHttpBinding_IMyService"); //var client1 = channelFactory.CreateChannel(); //var os = proxy.MyTransparentProxy.Create<IMyService>(client1); //os.DoWork(); }
static void TestService() { var client = new MyServiceClient(); var hello = client.Hello(); Console.WriteLine(hello); client.Close(); }