private void btnGetMessage_Click(object sender, EventArgs e) { try { if (client.State == System.ServiceModel.CommunicationState.Faulted) { client = new PracticeWCFService.PracticeServiceClient(); } lblMessage.Text = client.GetMessage(txtMessage.Text); } catch (Exception ex) { lblMessage.Text = ex.Message.ToString(); } }
public Form1() { InitializeComponent(); client = new PracticeWCFService.PracticeServiceClient(); }