示例#1
0
        static void Main(string[] args)
        {
            int    port;
            string dir = Directory.GetCurrentDirectory();

            if (args.Length == 0 || !int.TryParse(args[0], out port))
            {
                port = 80;
            }

            InitHostFile(dir);
            SimpleHost host = (SimpleHost)ApplicationHost.CreateApplicationHost(typeof(SimpleHost), "/", dir);

            host.Config("/", dir);

            WebServer server = new WebServer(host, port);

            server.Start();
            OpenUrl("http://127.0.0.1/default.aspx");

            var key = Console.ReadKey();

            while (key.Key != ConsoleKey.Enter)
            {
                Thread.Sleep(1000);
            }
            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            int port;
            string dir = Directory.GetCurrentDirectory();
            if(args.Length==0 || !int.TryParse(args[0],out port))
            {
                port = 45758;
            }

            InitHostFile(dir);
            SimpleHost host= (SimpleHost) ApplicationHost.CreateApplicationHost(typeof (SimpleHost), "/", dir);
            host.Config("/", dir);

            WebServer server = new WebServer(host, port);
            server.Start();
        }
示例#3
0
        static void Main(string[] args)
        {
            int    port;
            string dir = Directory.GetCurrentDirectory();

            if (args.Length == 0 || !int.TryParse(args[0], out port))
            {
                port = 45758;
            }

            InitHostFile(dir);
            SimpleHost host = (SimpleHost)ApplicationHost.CreateApplicationHost(typeof(SimpleHost), "/", dir);

            host.Config("/", dir);

            WebServer server = new WebServer(host, port);

            server.Start();
        }
示例#4
0
        static void Main(string[] args)
        {
            int port;
            string dir = Directory.GetCurrentDirectory();
            if(args.Length==0 || !int.TryParse(args[0],out port))
            {
                port = 80;
            }

            InitHostFile(dir);
            SimpleHost host= (SimpleHost) ApplicationHost.CreateApplicationHost(typeof (SimpleHost), "/", dir);
            host.Config("/", dir);

            WebServer server = new WebServer(host, port);
            server.Start();
            OpenUrl("http://127.0.0.1/default.aspx");

            var key = Console.ReadKey();
            while ( key.Key != ConsoleKey.Enter)
            {
                Thread.Sleep(1000);
            }
            Console.ReadKey();
        }