public void Start() { //create cache managers and web server _cacheManCollection = new CacheManagerCollection(); _webServer = new HttpServiceControler(); //add handler ThumbCachedHttpHandler handler = new ThumbCachedHttpHandler(); handler.SetManagerCollection(_cacheManCollection); _webServer.AddHandler(handler); _webServer.Start(); Console.WriteLine("ThumbCached server started!"); //show status while (true) { string cmd = Console.ReadLine(); if (string.Compare(cmd, "quit", true) == 0) { break; } Console.WriteLine("Enter \"quit\" or press Ctrl+C to exit program."); Console.WriteLine("Network connections: {0}", _webServer.Connections); } }
protected override void OnStart(string[] args) { try { //create cache managers and web server _cacheManCollection = new CacheManagerCollection(); _webServer = new HttpServiceControler(); //add handler ThumbCachedHttpHandler handler = new ThumbCachedHttpHandler(); handler.SetManagerCollection(_cacheManCollection); _webServer.AddHandler(handler); _webServer.Start(); } catch (Exception ex) { logger.Error(ex.Message); throw new ApplicationException("Starting ThumbCached service fail: " + ex.Message); } }