Exemplo n.º 1
0
        public static async Task <int> Main(string[] args)
        {
            var options = new KestrelServerOptions
            {
                AddServerHeader = false
            };

            if (!int.TryParse(args.FirstOrDefault(), out var port))
            {
                port = DefaultPort;
            }
            ;

            using (var server = new KestrelOwinServer(options))
                using (var streamStore = new InMemoryStreamStore())
                {
                    var url = new UriBuilder {
                        Port = port
                    }.Uri.ToString();
                    var owinPipeline = Configure(streamStore);

                    await server.Start(url, owinPipeline, CancellationToken.None);

                    DisplayMenu(streamStore, url);
                }

            return(0);
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            var options = new KestrelServerOptions
            {
                AddServerHeader = false
            };

            using (var server = new KestrelOwinServer(options))
            {
                server.Run("http://localhost:8080", Configure);
            }
        }