public static ServiceHost CreateService(params Uri[] pluginBaseAddress) { var hostControl = new PluginServerControl(pluginBaseAddress); var serviceHost = new ServiceHost(hostControl, pluginBaseAddress); serviceHost.AddServiceEndpoint( typeof(IPluginServerControl), new NetNamedPipeBinding(), nameof(PluginServerControl) ); serviceHost.PrintEndPoints(); Console.WriteLine($"pluginBaseAddress:{pluginBaseAddress}"); return(serviceHost); }
public static async Task Main(string[] args) { Console.WriteLine("Host started"); Console.WriteLine("Command Line args:"); foreach (var arg in args) { Console.WriteLine(arg); } KeepAlive = new SemaphoreSlim(0, 1); using (var controlService = PluginServerControl.CreateService(GetBaseAddress())) { controlService.Open(); Console.WriteLine("Control Service started"); await KeepAlive.WaitAsync(); controlService.Close(); } }