public ProcessWrapper() { remoteRepl = new Lazy<Wcf.ReplClient>(() => { process = Process.Start(new ProcessStartInfo("Gobiner.SecureRepl.exe", port.ToString()) { CreateNoWindow = true }); Thread.Sleep(500); var wcfClient = new Wcf.ReplClient(new System.ServiceModel.NetTcpBinding(), new System.ServiceModel.EndpointAddress("net.tcp://localhost:" + port + "/Repl")); return wcfClient; }); }
private void Dispose(bool disposing) { if (_wcfClient != null) WcfClient.Kill(); if (disposing) { _wcfClient.Abort(); } _wcfClient = null; Connections.Remove(this.ID); }
private void Initialize() { var unavailablePorts = new HashSet<int>(Connections.Values.Select(x => x.Port)); do { Port = Random.Next(10000, 20000); } while (unavailablePorts.Contains(Port)); var process = new Process() { StartInfo = new ProcessStartInfo(HttpContext.Current.Server.MapPath("~/bin/Gobiner.SecureRepl.exe"), Port.ToString()), }; process.Start(); ProcessID = process.Id; _wcfClient = new Wcf.ReplClient(new System.ServiceModel.NetTcpBinding(), new System.ServiceModel.EndpointAddress("net.tcp://localhost:" + Port + "/Repl")); }