I have a windows application(A), WCFService Library, WCFServiceApplication in my solution.
From windows application, when I hit submit, I can get data displayed on label.
Now what should I do to send the data from another application(Windows Application B) button click.
Here is code for Windows Application Form:
private void btnMainWindow_Click(object sender, EventArgs e)
{
ChannelFactory<IService1> factory = null;
try
{
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("");
factory = new ChannelFactory<IService1>(binding, address);
IService1 channel = factory.CreateChannel();
}
catch (CommunicationException ex)
{
if (factory != null)
factory.Abort();
}
catch (TimeoutException)
{
if (factory != null)
factory.Abort();
}
catch (Exception ex)
{
if (factory != null)
factory.Abort();
}
MessageBox.Show("Proxy closed");
}
My Interface
[ServiceContract]
public interface IMyService
{
[OperationContract]
string GetData(int value);
}
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
What I have tried:
I took both WCFService Library and WCFServiceApplication because, I didn't add Service Reference.