Start() public method

Start http server.
public Start ( int backLog ) : void
backLog int Number of pending connections.
return void
示例#1
0
        private static void Main(string[] args)
        {
            var filter = new LogFilter();
            filter.AddStandardRules();
            //LogFactory.Assign(new ConsoleLogFactory(filter));

            // create a server.
            var server = new Server();
            
            // same as previous example.
            var module = new FileModule();
            module.Resources.Add(new FileResources("/", Environment.CurrentDirectory + "\\files\\"));
            server.Add(module);
            server.RequestReceived += OnRequest;
            server.Add(new MultiPartDecoder());

            // use one http listener.
            server.Add(HttpListener.Create(IPAddress.Any, 8085));
            server.Add(new SimpleRouter("/", "/index.html"));

            // start server, can have max 5 pending accepts.
            server.Start(5);

            Console.ReadLine();
        }
示例#2
0
 static void Main(string[] args)
 {
     var localhost = "http://127.0.0.1";
     var port = Console.ReadLine();
     var server = new Server(localhost, port);
     server.Start();
 }
示例#3
0
        public static void HttpRestServer()
        {
            var server = new Server();
            var module = new RestModule();

            module.Endpoints.Add(new ReceiveRestEndpoint());
            module.Endpoints.Add(new SyncRestEndpoint());
            module.Endpoints.Add(new StopRestEndpoint());

            server.Add(module);

            // use one http listener.
            server.Add(HttpServer.HttpListener.Create(IPAddress.Loopback, DebugKeys.HttpListenerPort));
            server.Start(5);
        }
示例#4
0
 public static void Start()
 {
     if (_webServer != null)
     {
         _webServer.Start(0);
         return;
     }
     _webServer = new Server();
     _webServer.Add(HttpListener.Create(IPAddress.Any, 8080));
     _webServer.PrepareRequest += OnRequest;
     _webServer.Add(new StaticResourceHandler());
     _webServer.Add(new PageHandler());
     _webServer.Add(new SimpleRouter("/", "index.htm"));
     UserSession.Init(_webServer, true);
     _webServer.Start(0);
 }
示例#5
0
        private static void StartHTTP()
        {
            try
            {
                HttpServer.Logging.LogFactory.Assign(new HttpServer.Logging.ConsoleLogFactory(new HttpServer.Logging.LogFilter()));
                HTTP = new Server();
                HTTP.Add(HttpListener.Create(System.Net.IPAddress.Any, Settings.Get("HttpPort", 7780)));
                HTTP.Add(new HttpMod());
                HTTP.Start(32);

                LocalFileStorage = Settings.Get("LocalFiles", new Dictionary <string, string>());
            }
            catch (Exception ex)
            {
                Trace.WriteLine("HTTP Startup Error: " + ex.Message);
            }
        }
示例#6
0
        static void Main(string[] args)
        {
            // create a server.
            var server = new Server();

            // same as previous example.
            var module = new FileModule();
            module.Resources.Add(new FileResources("/", Environment.CurrentDirectory + "\\files\\"));
            server.Add(module);

            // use one http listener.
            server.Add(HttpListener.Create(IPAddress.Any, 8085));

            // add our own module.
            server.Add(new Streamer());


            // start server, can have max 5 pending accepts.
            server.Start(5);

            Console.ReadLine();
        }
        public override void Init(Kernel kernel)
        {
            PluginOptions = new PluginConfiguration<PluginOptions>(kernel, this.GetType().Assembly);
            PluginOptions.Load();
            Logger.ReportInfo("MBWeb (version "+Version+") Plug-in loaded.");

            server = new Server();
            server.Add(HttpServer.HttpListener.Create(IPAddress.Any, 9999));
            var module = new TinyWebModule();
            module.MapPath("/", "/index.html");
            server.Add(module);

            server.Start(5);
        }
 static void Main(string[] args)
 {
     var server = new Server();
     server.Start();
 }
示例#9
0
        private static void StartWebServer(string uri, string absolutePath, int port)
        {
            // create a server.
            var server = new Server();
            // add module to serve files i.e. act like a web server
            var module = new FileModule();
            
            // Add mime types for Silverlight PivotViewer
            module.ContentTypes.Add("xaml", new ContentTypeHeader("application/xaml+xml"));
            module.ContentTypes.Add("xap", new ContentTypeHeader("application/x-silverlight-2"));
            module.ContentTypes.Add("cxml", new ContentTypeHeader("text/xml"));
            module.ContentTypes.Add("xml", new ContentTypeHeader("text/xml"));
            module.ContentTypes.Add("dzi", new ContentTypeHeader("text/xml"));
            module.ContentTypes.Add("dzc", new ContentTypeHeader("text/xml"));
            
            module.Resources.Add(new FileResources("/", absolutePath));
            server.Add(module);

            // use one http listener.
            server.Add(HttpListener.Create(IPAddress.Any, port));
            // start server, can have max 5 pending accepts.
            server.Start(5);
        }
示例#10
0
        public WordLaunch(ServerInfo targetserver)
        {
            InitializeComponent();
            this.targetserver = targetserver;
            plugin = new PluginRpc(targetserver.conn.URL);
            medsize = plugin.GetMediumSize();

            txt_Content.NativeInterface.SetCodePage((int)Constants.SC_CP_UTF8);

            CategoryFullInfo[] cfi = targetserver.conn.GetCategories(0, targetserver.username, targetserver.password);
            foreach (CategoryFullInfo cf in cfi)
            {
                CheckBox cb = new CheckBox();
                cb.Name = "cb_" + cf.categoryName;
                cb.Text = cf.categoryName;
                cb.Tag = cf;
                flow_Categories.Controls.Add(cb);
            }

            postResources = GetNextAvailableDir();
            Directory.CreateDirectory(postResources);

            var module = new FileModule();
            webserv = new Server();
            module.Resources.Add(new FileResources("/",postResources));
            webserv.Add(module);
            webserv.Add(new MultiPartDecoder());
            webserv.RequestReceived+=new EventHandler<RequestEventArgs>(webserv_RequestReceived);

            // use one http listener.
            webserv.Add(HttpListener.Create(System.Net.IPAddress.Any, webservport));
            webserv.Start(5);

            // Find a valid post to use
            url = targetserver.conn.URL.Replace("xmlrpc.php", "?p=2147483646");
        }