protected override void OnStart(string[] args) { _serviceManager = ServerManager.Servers(); Task.Run(() => { _serviceManager.StartAll(); _serviceManager.WaitForConnections(); }); }
public static ServerManager Servers() { lock (_lock) { if (_instance == null) { _instance = new ServerManager(); AppDomain.CurrentDomain.UnhandledException -= CurrentDomainOnUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; } } return _instance; }
private static void Main(string[] args) { _serviceManager = ServerManager.Servers(); Task.Run(() => { _serviceManager.StartAll(); foreach (var s in _serviceManager.AllServers) { System.Console.WriteLine("Listening on {0}", s.Port); } _serviceManager.WaitForConnections(); }); System.Console.ReadLine(); }
public static void Cleanup() { if (_iisExpress != null) { _iisExpress.Dispose(); } var iexps = Process.GetProcessesByName("IISExpress"); foreach (var iexp in iexps) { iexp.Kill(); } if (_serviceManager != null) { _serviceManager.Stop(); _serviceManager = null; } }
public static void Init(TestContext ctx) { ServicePointManager.Expect100Continue = false; ServicePointManager.CheckCertificateRevocationList = false; ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => { return true; }; _serviceManager = ServerManager.Servers().StartAll(); var iexps = Process.GetProcessesByName("IISExpress"); foreach (var iexp in iexps) { iexp.Kill(); } var projDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.Parent.Parent.FullName; var webroot = Path.Combine(projDir, "Websites"); _iisExpress = new IISExpress(new Parameters { Path = webroot, Port = 56123, Systray = false }); }
protected override void OnStop() { _serviceManager.Stop(); _serviceManager = null; }