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); } }
static void Main(string[] args) { SimpleHandler handler = new SimpleHandler(); HttpServiceControler server = new HttpServiceControler(); server.AddHandler(handler); server.Start(); Console.WriteLine("Server has start."); Console.WriteLine("Try to type http://localhost:8080/ in web broswer."); Console.ReadLine(); server.Stop(); }
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); } }