static public void RunServer() { _heartbeat = new Hearbeat(); ElevatedService service = new ElevatedService(_heartbeat); ServiceHost sh = new ServiceHost(service, new Uri("net.pipe://localhost/myPipe")); NetNamedPipeBinding np = new NetNamedPipeBinding(); sh.AddServiceEndpoint(typeof(IElevatedOperationsInterface), np, "elevatedServices"); sh.Open(); _heartbeat.Beat(); //give parent time to connect waitForDebugger(); while (isParentProcessAlive()) { _heartbeat.Reset(); Thread.Sleep(60000); } sh.Close(); }
static public void RunServer() { _heartbeat = new Hearbeat(); ElevatedService service = new ElevatedService(_heartbeat); ServiceHost sh = new ServiceHost(service, new Uri("net.pipe://localhost/myPipe")); NetNamedPipeBinding np = new NetNamedPipeBinding(); sh.AddServiceEndpoint(typeof(IElevatedOperationsInterface), np, "elevatedServices"); sh.Open(); _heartbeat.Beat(); //give parent time to connect waitForDebugger(); while (isParentProcessAlive()) { _heartbeat.Reset(); Thread.Sleep(60000); } sh.Close(); }