A class that serves as the base for all ASP hosted websites.
Ejemplo n.º 1
0
        /// <summary>
        ///     Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The command-line arguments passed to the application.</param>
        public static int Main(string[] args)
        {
            var options = new Options();
            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                return -1;
            }

            Console.Write("Starting Web Server ... ");

            int port = options.Port;
            if (port == -1)
            {
                port = NetworkUtility.FindRandomOpenPort();
            }

            var webServer = new NettyServer(options.PhysicalPath, options.VirtualPath, port);

            // Update an application setting, and then start the server
            webServer.Start();

            Console.WriteLine("Done.");
            Console.WriteLine("Listening at: {0}", webServer.Port);
            Console.WriteLine("Press [ENTER] to exit.");

            Console.ReadLine();

            // Stop the web server - this will restore the configuration to the original values
            Console.WriteLine("Stopping Web Server ... ");

            webServer.Stop();

            return 0;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The command-line arguments passed to the application.</param>
        public static void Main(string[] args)
        {
            Console.Write("Starting Web Server ... ");

            // Setup a new web server using a random port.  The ports can be shared as long as
            // the virtual path is unique.
            var webServer = new NettyServer(@"..\..\..\SampleWebsite", "/Sample/");

            // Update an application setting, and then start the server
            webServer
                .AlterApplicationSetting("Key1", "I am updated.")
                .Start();

            Console.WriteLine("Done.");
            Console.WriteLine("Listening at: {0}", webServer.Port);
            Console.WriteLine("Press [ENTER] to exit.");

            Console.ReadLine();

            // Stop the web server - this will restore the configuration to the original values
            Console.WriteLine("Stopping Web Server ... ");

            webServer.Stop();
        }
Ejemplo n.º 3
0
 public static void Startup()
 {
     _webServer = new NettyServer(@"..\..\..\SampleWebSite", "/", 9015);
     _webServer.Start();
 }