public void Start () { MainConsole.Instance.InfoFormat ( "[Base HTTP Server]: Starting {0} server on port {1}", Secure ? "HTTPS" : "HTTP", Port); try { //m_httpListener = new HttpListener(); NotSocketErrors = 0; m_internalServer = new HttpListenerManager (m_threadCount, Secure); if (OnOverrideRequest != null) m_internalServer.ProcessRequest += OnOverrideRequest; else m_internalServer.ProcessRequest += OnRequest; m_internalServer.Start (m_port); // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events m_PollServiceManager = new PollServiceRequestManager (3, 25000); m_PollServiceManager.Start (); HTTPDRunning = true; } catch (Exception e) { if (e is HttpListenerException && ((HttpListenerException)e).Message == "Access is denied") MainConsole.Instance.Error ("[Base HTTP Server]: You must run this program as an administrator."); else { MainConsole.Instance.Error ("[Base HTTP Server]: Error - " + e.Message); MainConsole.Instance.Error ("[Base HTTP Server]: Tip: Do you have permission to listen on port " + m_port + "?"); } // We want this exception to halt the entire server since in current configurations we aren't too // useful without inbound HTTP. throw e; } }
public void Start() { MainConsole.Instance.InfoFormat ( "[Base HTTP server]: Starting {0} server on port {1}", Secure ? "HTTPS" : "HTTP", Port); try { //m_httpListener = new HttpListener(); NotSocketErrors = 0; m_internalServer = new HttpListenerManager (m_threadCount, Secure); if (OnOverrideRequest != null) m_internalServer.ProcessRequest += OnOverrideRequest; else m_internalServer.ProcessRequest += OnRequest; m_internalServer.Start (m_port); // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events m_PollServiceManager = new PollServiceRequestManager (3, 25000); m_PollServiceManager.Start (); HTTPDRunning = true; } catch (Exception e) { if (e is HttpListenerException && ((HttpListenerException)e).Message == "Access is denied") MainConsole.Instance.Error ("[Base HTTP server]: You must run this program as an administrator."); else { MainConsole.Instance.Error ("[Base HTTP server]: Error - " + e.Message); MainConsole.Instance.Error ("[Base HTTP server]: Tip: Do you have permission to listen on port " + m_port + "?"); } // We want this exception to halt the entire server since in current configurations we aren't too // useful without inbound HTTP. throw e; } }