private void button2_Click(object sender, EventArgs e) { ServiceReference1.ExecuteServiceRequest req = new ServiceReference1.ExecuteServiceRequest(); SomeCompany.BE.AccountBE account = new SomeCompany.BE.AccountBE(); account.Name = "alskflH FLADSKFÑL SFFSADF FSDFSF"; account.Id = 12342134; account.TypeId = 1009; req.jsonRequets = Newtonsoft.Json.JsonConvert.SerializeObject(account, Newtonsoft.Json.Formatting.Indented); NetTcpBinding binding = new NetTcpBinding(); binding.Name = "tcp"; EndpointAddress address = new EndpointAddress("net.tcp://localhost:8001/FwkService"); using (ServiceReference1.FwkServiceClient svcProxy = new ServiceReference1.FwkServiceClient(binding, address)) { svcProxy.Open(); ServiceReference1.ExecuteServiceResponse res = svcProxy.ExecuteService(req); } }
void checkProxy() { if(svcProxy==null) { svcProxy = new ServiceReference1.FwkServiceClient("FirstEndpoint"); svcProxy.Open(); } }