I need to host a WCF service inside a Windows Forms application and call the WCF service from a Windows service that will send data to the WCF service which will show it in
Use the below code to host the WCF service in a Windows Forms application:
using System.ServiceModel.Channels;
ServiceHost host = new ServiceHost(typeof(MyNamespace.OrderService));
BindingElementCollection bec = new BindingElementCollection();
SymmetricSecurityBindingElement ssbe = new
SymmetricSecurityBindingElement();
ssbe.LocalServiceSettings.InactivityTimeout = new TimeSpan(0, 10, 0);
bec.Add(ssbe);
bec.Add(new TextMessageEncodingBindingElement());
bec.Add(new HttpsTransportBindingElement());
CustomBinding customBinding = new CustomBinding(bec);
host.AddServiceEndpoint(typeof(MyNamespace.IOrderService),customBinding,"http://localhost:8000/O
rderService/");