コード例 #1
0
ファイル: Program.cs プロジェクト: CallumVass/Nancy
 static void Main(string[] args)
 {
     using (var host = new NancyHost(new NancyBootstrapper(), new Uri(@"http://localhost:1234")))
     {
         host.Start();
         Console.ReadLine();
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: ToJans/Nancy
 static void Main(string[] args)
 {
     var nancyHost = new NancyHost(new Uri("http://localhost:8888/nancy/"));
     nancyHost.Start();
     Console.WriteLine("Nancy now listening - navigate to http://localhost:8888/nancy/. Press enter to stop");
     Console.ReadKey();
     nancyHost.Stop();
     Console.WriteLine("Stopped. Good bye!");
 }
コード例 #3
0
    public static void Main()
    {
        using (var nancyHost = new NancyHost(new Uri("http://localhost:8888/")))
        {
            nancyHost.Start();

            Console.WriteLine("Nancy now listening - navigating to http://localhost:8888/. Press enter to stop");
            Process.Start("http://localhost:8888/");

            Console.ReadKey();
        }
    }
コード例 #4
0
        public void Start()
        {
            nancyHost = new NancyHost(bootstrapper, new HostConfiguration
            {
                UrlReservations = new UrlReservations
                {
                    CreateAutomatically = true
                },
            }, new Uri("http://localhost:9999"));

            nancyHost.Start();
        }
コード例 #5
0
        public static void Main()
        {
            var hostUri = "http://localhost:1234";

            StaticConfiguration.DisableErrorTraces = false;
            using (var host = new NancyHost(new Uri(hostUri), new ConsoleBootstrapper())) {
                host.Start();
                Process.Start(hostUri);
                Console.WriteLine("Press any key to exit.");
                Console.ReadKey();
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: krmrcn/NancyFw
        static void Main()
        {
            var host = new Uri("http://localhost:3406");

            using (var server = new NancyHost(host))
            {
                server.Start();
                Console.WriteLine("Host is up!");
                Console.ReadKey();
                server.Stop();
            }
        }
コード例 #7
0
        public static void Main(string[] args)
        {
            var endpoint = "http://localhost:1234";

            using (var host = new NancyHost(new Uri(endpoint)))
            {
                host.Start();

                Console.WriteLine("Server started on {0}...", endpoint);
                Console.ReadLine();
            }
        }
コード例 #8
0
        static void Main(string[] args)
        {
            Uri endpoint = new Uri("http://localhost:1234");

            using (var host = new NancyHost(endpoint, new MyBootstrapper()))
            {
                host.Start();
                Console.WriteLine("Running on http://localhost:1234");
                Console.ReadLine();
                host.Stop();
            }
        }
コード例 #9
0
        public static NancyHost Start(string serviceUri, ILifetimeScope lifetimeScope)
        {
            var hostConfig = new HostConfiguration {
                UrlReservations = new UrlReservations {
                    CreateAutomatically = true
                }
            };
            var nancyHost = new NancyHost(new Uri(serviceUri), new NonScanningAutofacNancyBootstrapper(lifetimeScope), hostConfig);

            nancyHost.Start();
            return(nancyHost);
        }
コード例 #10
0
        private static void Main(string[] args)
        {
            var uri =
                new Uri("http://localhost:1884");

            using (var host = new NancyHost(uri)) {
                host.Start();
                Console.WriteLine($"{DateTime.Now}    Simple web server running on {uri}");
                Console.WriteLine("Press [Enter] to close the host.");
                Console.ReadLine();
            }
        }
コード例 #11
0
        static void Main(string[] args)
        {
            var url = new Uri("http://localhost:12345");

            using (var host = new NancyHost(new DefaultNancyBootstrapper(), url)) {
                host.Start();

                Console.WriteLine("Now listening, have fun!");

                Console.ReadLine();
            }
        }
コード例 #12
0
        internal static void Main(string[] args)
        {
#if DEBUG
            using (
                var host = new NancyHost(new Uri("http://localhost:5000")))
            {
                host.Start();
                Console.WriteLine("Running on http://localhost:5000");
                Console.ReadLine();
            }
#endif
        }
コード例 #13
0
        public void Start()
        {
            var opts = new HostConfiguration
            {
                UrlReservations          = { CreateAutomatically = true },
                EnableClientCertificates = true,
                RewriteLocalhost         = false
            };

            _host = new NancyHost(opts, new Uri(Url));
            _host.Start();
        }
コード例 #14
0
        public NancyModuleRunner(Action <ConfigurableBootstrapper.ConfigurableBoostrapperConfigurator> configuration)
        {
            var host = "localhost";
            int port = TCPUtil.GetAvailableTCPPort(8081, 8090);

            BaseUrl = "http://" + host + ":" + port + "/";

            var bootStrapper = new ConfigurableBootstrapper(configuration);

            _nancyHost = new NancyHost(bootStrapper, new Uri(BaseUrl));
            _nancyHost.Start();
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: AmrReda/NancyFX-Samples
        static void Main(string[] args)
        {
            var uri  = "http://locahost:1235";
            var host = new NancyHost(new Uri(uri));


            host.Start();

            Console.ReadKey();

            host.Stop();
        }
コード例 #16
0
        static void Main()
        {
            Mapper.CreateMap <UserDetails, UserSummary>();
            Mapper.CreateMap <RoleDetails, Role>();

            using (var host = new NancyHost(new Uri("http://localhost:1234")))
            {
                host.Start();
                Console.WriteLine("Server running on http://localhost:1234");
                Console.ReadLine();
            }
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: UnLeving/rest-api-nancy
        static void Main(string[] args)
        {
            NancyHost host = new NancyHost(new Uri("http://localhost:1234"), new Bootstrapper());

            host.Start();
            Console.WriteLine("nancy host running...");
            Console.WriteLine("press enter to stop");
            Console.ReadLine();
            Console.WriteLine("nancy host STOPPED!");
            host.Stop();
            //ConfigureService.Configure();
        }
コード例 #18
0
        public void Start()
        {
            var port = _configuration["WebSitePort"];

            var url = "http://localhost:" + port;

            //API / Web server
            m_nancyHost = new NancyHost(new Uri(url));
            m_nancyHost.Start();

            //StatsCounter.Instance.PropertyChanged += Instance_PropertyChanged;
        }
コード例 #19
0
        static void Main()
        {
            Manifest.GenerateEntries();
            Manifest.GenerateStore();

            using (var host = new NancyHost(new Uri("http://localhost:1234")))
            {
                host.Start();
                Console.WriteLine("Running on http://localhost:1234");
                Console.ReadKey();                 //letting cats shutdown systems since 1999.
            }
        }
コード例 #20
0
        public static void Main(string[] args)
        {
            var host = new NancyHost(new Uri("http://localhost:12340"));

            StaticConfiguration.DisableErrorTraces = false;

            host.Start();

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
            host.Stop();
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: loftum/nancydemo
        static void Main(string[] args)
        {
            var uri = new Uri("http://selfhost.nancyde.mo");

            using (var host = new NancyHost(uri))
            {
                host.Start();
                Console.WriteLine("Started Nancy self host");
                Console.WriteLine("Hit enter very softly to stop");
                Console.ReadLine();
            }
        }
コード例 #22
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        /// <param name="args">The command-line arguments.</param>
        public static void Main(string[] args)
        {
            // Lancement du serveur web
            NancyHost host = new NancyHost(new Uri("http://localhost:10563"));

            host.Start();

            Console.WriteLine("Running on http://localhost:10563");

            // Attente du programme
            Console.ReadLine();
        }
コード例 #23
0
 static void Main(string[] args)
 {
     Console.WriteLine("TEST LOGGING");
     Host = new NancyHost(CurrentAddress);
     Host.Start();
     Console.WriteLine("Nancy is started and listening on {0}...", CurrentAddress);
     while (Console.ReadLine() != "quit")
     {
         ;
     }
     Host.Stop();
 }
コード例 #24
0
ファイル: TeenService.cs プロジェクト: Delnar/TeenCheckin
        public void StartWebHost()
        {
            if (_WebHost != null)
            {
                _WebHost.Stop();
                _WebHost.Dispose();
            }
            string URL = "http://localhost";

            _WebHost = new NancyHost(new Uri(URL));
            _WebHost.Start();
        }
コード例 #25
0
        public MainWindow()
        {
            _dataGenerator = new DataGenerator();
            //_dataGenerator.GetCommentsDB();

            InitializeComponent();
            Shows.ItemsSource = _dataGenerator.shows;
            AnimalList.ItemsSource = _dataGenerator.animals;

            var host = new NancyHost(new Uri("http://localhost:1234"));
            host.Start();
        }
コード例 #26
0
ファイル: Program.cs プロジェクト: ccdschool/ioc
        public static void Main(string[] args)
        {
            var port = args.FirstOrDefault() ?? "8080";
            var url  = $"http://localhost:{port}";

            using (var host = new NancyHost(new Uri(url))) {
                host.Start();
                Console.WriteLine($"Running on {url}");
                Console.WriteLine("Press <Enter> to stop...");
                Console.ReadLine();
            }
        }
コード例 #27
0
 public static void StartHost()
 {
     //监听本地接口
     using (var host = new NancyHost(hostConfig, new Uri("http://localhost:31730")))
     {
         host.Start();
         while (true)
         {
             ;
         }
     }
 }
コード例 #28
0
        static void Main(string[] args)
        {
            var url = "http://localhost:3100";

            using (var host = new NancyHost(new Uri(url)))
            {
                Console.WriteLine($"Start web server on {url}\nOpen it in your browser...\nPress any key to stop it...");
                host.Start();
                Console.ReadKey();
                host.Stop();
            }
        }
コード例 #29
0
        static void Main(string[] args)
        {
            var nancyHost = new NancyHost(new Bootstrapper.Bootstrapper(), new Uri("http://localhost:8888"), new Uri("http://127.0.0.1:8888"));

            nancyHost.Start();

            Console.WriteLine("Nancy now listening - navigating to http://localhost:8888. Press enter to stop");
            Process.Start("http://localhost:8888");
            Console.ReadKey();
            nancyHost.Stop();
            Console.WriteLine("Stopped. Good bye!");
        }
コード例 #30
0
        static void Main(string[] args)
        {
            Console.Title = "Flow";
            PersistenceIP = FindServerInLocalNetwork(PersistencePort);

            using (var host = new NancyHost(new Uri($"http://localhost:{Port}")))
            {
                host.Start();
                Console.WriteLine($"http://{IP}:{Port}");
                Console.ReadLine();
            }
        }
コード例 #31
0
        static void Main(string[] args)
        {
            using (var host = new NancyHost(new Uri("http://localhost:12088")))
            {
                host.Start();

                while (Console.ReadLine() != "quit")
                {
                    Thread.Sleep(Int32.MaxValue);
                }
            }
        }
コード例 #32
0
        public void CreateServer()
        {
            var port = "1234";
            var foundValueInConfig = ConfigurationManager.AppSettings["port"];

            if (!string.IsNullOrEmpty(foundValueInConfig))
            {
                port = foundValueInConfig;
            }
            _host = new NancyHost(new Uri("http://localhost:" + port));
            _host.Start();
        }
コード例 #33
0
ファイル: Program.cs プロジェクト: Borzoo/Nancy
        static void Main(string[] args)
        {
            var uri =
                new Uri("http://localhost:3579");

            using (var host = new NancyHost(uri))
            {
                host.Start();

                Console.WriteLine("Your application is running on " + uri);
                Console.WriteLine("Press any [Enter] to close the host.");
                Console.ReadLine();
            }
        }
コード例 #34
0
        public void Should_be_get_an_exception_indicating_a_conflict_when_trying_to_listen_on_a_used_prefix()
        {
            Exception ex;

            // Given
            using (CreateAndOpenSelfHost())
            {
                // When
                ex = Record.Exception(() =>
                    {
                        using (var host = new NancyHost(BaseUri))
                        {
                            host.Start();
                        }
                    });
            }

            // Then
            ex.Message.ShouldContain("conflict");
        }
コード例 #35
0
        private static NancyHostWrapper CreateAndOpenSelfHost(INancyBootstrapper nancyBootstrapper = null, HostConfiguration configuration = null)
        {
            if (nancyBootstrapper == null)
            {
                nancyBootstrapper = new DefaultNancyBootstrapper();
            }

            var host = new NancyHost(
                nancyBootstrapper,
                configuration,
                BaseUri);

            try
            {
                host.Start();
            }
            catch
            {
                throw new SkipException("Skipped due to no Administrator access - please see test fixture for more information.");
            }

            return new NancyHostWrapper(host);
        }
コード例 #36
0
ファイル: Host.cs プロジェクト: n-alex-white/ServicePulse
 protected override void OnStart(string[] args)
 {
     nancyHost = new NancyHost(new Uri(arguments.Url), new PulseBootstrapper());
     nancyHost.Start();
 }