コード例 #1
0
ファイル: Program.cs プロジェクト: richorama/Jukebox
        static void Main(string[] args)
        {
            var path = ConfigurationManager.AppSettings["path"];

            string[] paths = null;
            if (string.IsNullOrWhiteSpace(path))
            {
                paths = new string[] { GetHome() };
            }
            else
            {
                paths = (path ?? "").Split(';');
            }

            Action a = new Action(() => { Catalogue.Index(paths); });

            a.BeginInvoke(null, null);


            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1337"));

            Console.WriteLine("Web server started on port {0}", port);
            nancyHost.Start();
            Console.ReadLine();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: kmorcinek/HackKrkService
        static void Main(string[] args)
        {
            var host = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:8080"));
            host.Start();

            Console.ReadKey();
        }
コード例 #3
0
 static void Main(string[] args)
 {
     Console.Write("Starting server...");
     var server = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:8282"));
     server.Start();
     StaticConfiguration.DisableErrorTraces = false;
     Console.Read();
 }
コード例 #4
0
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234"));
            nancyHost.Start();

            Console.ReadLine();
            nancyHost.Stop();
        }
コード例 #5
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello Nancy 1.4!");
            var nancyhost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:3333"));

            nancyhost.Start();
            Console.ReadLine();
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: jjchiw/NancyRavenTodoMvc
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:8081"), new TodoMvcBootstrap());
            nancyHost.Start();

            Console.ReadLine();
            nancyHost.Stop();
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: grumpydev/Isochronal
 static void Main(string[] args)
 {
     var host = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:8888/Nancy/"));
     host.Start();
     Process.Start("http://localhost:8888/Nancy/");
     Console.WriteLine("Press [ENTER] to stop");
     Console.ReadLine();
     host.Stop();
 }
コード例 #8
0
        static void Main(string[] args)
        {
            Console.Write("Starting server...");
            var server = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:8282"));

            server.Start();
            StaticConfiguration.DisableErrorTraces = false;
            Console.Read();
        }
コード例 #9
0
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234"));

            nancyHost.Start();
            Console.WriteLine("NancyFX API running");
            Console.ReadLine();
            nancyHost.Stop();
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: ralfw/ccdacdnov13
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234"));
            nancyHost.Start();

            Console.WriteLine("Serving... - until being killed");
            Console.ReadLine();

            nancyHost.Stop();
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: theClueless/MixMax
        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:9664"));
             nancyHost.Start();
             Console.WriteLine("Web server running...");

            Process.Start("http://localhost:9664");

             Console.ReadLine();
             nancyHost.Stop();
        }
コード例 #12
0
        static void Main(string[] args)
        {
            var hostUrl = "http://localhost:" + ConfigurationManager.AppSettings["Port"];
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri(hostUrl));
            nancyHost.Start();

            Console.WriteLine("Nancy host listening on " + hostUrl);

            Console.ReadLine();
            nancyHost.Stop();
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: MagicalLas/Nete_Lin
 static void Main()
 {
     using (var host = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234")))
     {
         host.Start();
         Console.WriteLine("Running on http://localhost:1234");
         new LasModules();
         Console.ReadLine();
         host.Stop();
     }
 }
コード例 #14
0
        public void Start()
        {
            const string url       = "http://localhost:9090";
            var          nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri(url));

            nancyHost.Start();
            CheckMailThread = new Thread(CheckMailCaller);
            CheckMailThread.Start();


            Console.WriteLine("Billing service is listening on {0}", url);
        }
コード例 #15
0
        static void Main(string[] args)
        {
            var hostUrl   = "http://localhost:" + ConfigurationManager.AppSettings["Port"];
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri(hostUrl));

            nancyHost.Start();

            Console.WriteLine("Nancy host listening on " + hostUrl);

            Console.ReadLine();
            nancyHost.Stop();
        }
コード例 #16
0
ファイル: Main.cs プロジェクト: duhaly/NancyFXExample
 public static void Main(string[] args)
 {
     var config = new Nancy.Hosting.Self.HostConfiguration();
     config.UnhandledExceptionCallback += (ex) => {
         Console.WriteLine(ex);
     };
     var nancyHost = new Nancy.Hosting.Self.NancyHost(config, new Uri("http://localhost:7000"));
     nancyHost.Start();
     Console.ReadLine();
     nancyHost.Stop();
     System.Threading.Thread.Sleep(1000);
 }
コード例 #17
0
ファイル: Program.cs プロジェクト: ralfw/ccdacdnov13
        static void Main(string[] args)
        {
            __exit = new AutoResetEvent(false);

            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234"));
            nancyHost.Start();

            Console.WriteLine("Serving...");
            __exit.WaitOne();

            nancyHost.Stop();
        }
コード例 #18
0
        static void Main(string[] args)
        {
            var port      = 8765;
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:" + port));

            Console.WriteLine("Running port: {0}", port);

            nancyHost.Start();

            Console.ReadKey();

            nancyHost.Stop();
        }
コード例 #19
0
ファイル: Program.cs プロジェクト: ralfw/InteractionHost
        public static void Main(string[] args)
        {
            var homeUri = new Uri("http://localhost:8080");

            using (var host = new Nancy.Hosting.Self.NancyHost(homeUri))
            {
                host.Start();

                Console.WriteLine($"Interaction Host listening on {homeUri}");
                Console.WriteLine("Press ENTER to stop...");
                Console.ReadLine();
            }
        }
コード例 #20
0
        public static void StartHost(UpdateRegionDelegate update, GetMapRulesDelegate rules, CheckAPIKeyDelegate keychecker, string domain = "localhost", uint port = 6473, bool useSSL = true)
        {
            _updateRegionDelegate = update;
            _getMapRulesDelegate  = rules;
            _checkAPIKeyDelegate  = keychecker;

            var protocol = useSSL ? "https" : "http";

            BINDING_CONFIG.BodyOnly = true;

            _host = new Nancy.Hosting.Self.NancyHost(new Uri($"{protocol}://{domain}:{port}"));
            _host.Start();
        }
コード例 #21
0
        static void Main(string[] args)
        {
            string httpUrl      = "http://0.0.0.0:9664";
            string websocketUrl = "ws://0.0.0.0:9966";

            if (OperatingSystem.IsWindows())
            {
                httpUrl      = "http://127.0.0.1:9664";
                websocketUrl = "ws://127.0.0.1:9966";
            }
            var tokenSource      = new CancellationTokenSource();
            CancellationToken ct = tokenSource.Token;

            if (args.Length > 0)
            {
                r2warsStatic.torneo.SetWarriorsDirectory(args[0]);
            }

            var taskA = new Task(() =>
            {
                var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri(httpUrl), new CustomBootstrapper());
                nancyHost.Start();
                Console.WriteLine("Web server running at " + httpUrl);

                Process.Start(httpUrl);


                while (!ct.IsCancellationRequested)
                {
                    Thread.Sleep(1000);
                }
                nancyHost.Stop();
            }, tokenSource.Token);

            var taskB = new Task(() =>
            {
                var wssv = new WebSocketServer(websocketUrl);
                wssv.AddWebSocketService <r2warsWebSocket>("/r2wars");
                wssv.Start();
                while (!ct.IsCancellationRequested)
                {
                    Thread.Sleep(1000);
                }
                wssv.Stop();
            }, tokenSource.Token);

            taskA.Start();
            taskB.Start();
            Console.ReadKey();
            tokenSource.Cancel();
        }
コード例 #22
0
        public void RunWebService()
        {
            int port = 50006;

            int.TryParse(BauerLib.Registry.ServicePort, out port);

            if (PortInUse(port))
            {
                log.ErrorFormat("Error {0} in use !", port);
                return;
            }

            string baseAddress = string.Format("http://localhost:{0}", port);

            Nancy.ViewEngines.DotLiquid.DotLiquidRegistrations r = new Nancy.ViewEngines.DotLiquid.DotLiquidRegistrations();
            DotLiquid.Template.NamingConvention = new DotLiquid.NamingConventions.CSharpNamingConvention();

            Nancy.Hosting.Self.HostConfiguration hostConfigs = new Nancy.Hosting.Self.HostConfiguration();
            // netsh http add urlacl url=http://+:50006/ user=EVERYONE
            // netsh http add urlacl url=http://+:50006/ user=JEDER
            hostConfigs.UrlReservations.CreateAutomatically = false;
            hostConfigs.RewriteLocalhost = true;

            int retries = 6;

            while (retries > 0)
            {
                try
                {
                    host = new Nancy.Hosting.Self.NancyHost(hostConfigs, new Uri(baseAddress));
                    host.Start();
                    retries = -1;
                }
                catch (Exception ex)
                {
                    log.Error("Error starting rest-service", ex);
                    retries--;
                    if (retries <= 3)
                    {
                        hostConfigs.UrlReservations.CreateAutomatically = true;
                    }
                    System.Threading.Thread.Sleep(500);
                }
            }
            log.InfoFormat("Running on {0}", baseAddress);

            if (Environment.UserInteractive)
            {
                System.Diagnostics.Process.Start(baseAddress);
            }
        }
コード例 #23
0
        public TimesheetApp()
        {
            InitializeComponent();

            const string appAddress = "http://*****:*****@"Timesheet Standalone. Navigate to: " + appAddress;
            this.Load += (sender, args) => this.addressTextbox.Invoke(textUpdate); ;
            this.FormClosed += (sender, args) => nancyHost.Stop();
        }
コード例 #24
0
        public TimesheetApp()
        {
            InitializeComponent();

            const string appAddress = "http://*****:*****@"Timesheet Standalone. Navigate to: " + appAddress;

            this.Load       += (sender, args) => this.addressTextbox.Invoke(textUpdate);;
            this.FormClosed += (sender, args) => nancyHost.Stop();
        }
コード例 #25
0
 public string GetAuthorizationCode()
 {
     using (var host = new Nancy.Hosting.Self.NancyHost(new Nancy.Hosting.Self.HostConfiguration()
     {
         UrlReservations = { CreateAutomatically = true }
     }, new System.Uri(redirectUrl)))
     {
         host.Start();
         eventWaitHandler = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.ManualReset);
         Log("launch operating system default web browser: " + url);
         System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(url));
         eventWaitHandler.WaitOne();
         Log("authorization code: " + authorizationCode);
         System.Threading.Thread.Sleep(1000);
     }
     return(authorizationCode);
 }
コード例 #26
0
        public void RunTests(IEnumerable <TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            var configuration = new Mocha.BddConfiguration(); //TODO: unhardcode
            var harnessFile   = "harness.html";

            var sources = tests
                          .Select(t => t.Source)
                          .Distinct();

            //TODO: allow multiple roots / multiple configs / multiple projects
            var rootPath = PathFinder.FindRootDirectoryForFile(sources.First());

            HarnessBuilder.CreateHarnessFile(configuration, sources, rootPath, harnessFile);

            var hostConfig = new Nancy.Hosting.Self.HostConfiguration()
            {
                RewriteLocalhost = true,
                UrlReservations  = new Nancy.Hosting.Self.UrlReservations()
                {
                    CreateAutomatically = true
                }
            };
            var port = "8081"; //TODO: unhardcode
            var uri  = String.Format("http://localhost:{0}", port);

            var host = new Nancy.Hosting.Self.NancyHost(
                new Uri(uri),
                new NancySettingsBootstrapper(rootPath),
                hostConfig
                );

            host.Start();

            //Run phantom per harness
            var harnessUri    = uri + "/" + harnessFile;
            var phantomrunner = new PhantomRunner(frameworkHandle, tests);
            var phantomResult = phantomrunner.Run(harnessUri);

            phantomResult.Wait();

            host.Stop();
        }
コード例 #27
0
ファイル: Program.cs プロジェクト: richorama/Jukebox
        static void Main(string[] args)
        {
            var path = ConfigurationManager.AppSettings["path"];
            string[] paths = null;
            if (string.IsNullOrWhiteSpace(path))
            {
                paths = new string[] { GetHome() };
            }
            else
            {
                paths = (path ?? "").Split(';');
            }

            Action a = new Action(() => { Catalogue.Index(paths); });
            a.BeginInvoke(null, null);

            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1337"));
            Console.WriteLine("Web server started on port {0}", port);
            nancyHost.Start();
            Console.ReadLine();
        }
コード例 #28
0
ファイル: Program.cs プロジェクト: vancomplx/openbank
        static void Main(string[] args)
        {
            Console.WriteLine("--Welcome to OpenBank--");
            Console.WriteLine();
            Console.Write("Starting up...");

            System.Net.ServicePointManager.ServerCertificateValidationCallback = CertificateValidator;

            string port = ConfigurationManager.AppSettings["port"];

            using (var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri(string.Concat("http://localhost:", port))))
            {
                nancyHost.Start();
                Console.WriteLine("success!");

                Console.WriteLine(string.Format("Server listening on port {0} and waiting for connections.", port));
                Console.WriteLine(string.Format("Navigate to http://localhost:{0}/ for help.", port));

                Wait();

                nancyHost.Stop();
            }
        }
コード例 #29
0
        static void Main(string[] args)
        {
            Uri domainUri = null;

            try
            {
                domainUri = new Uri("http://localhost:8088");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Environment.Exit(0);
            }

            // create a new self-host server
            var nancyHost = new Nancy.Hosting.Self.NancyHost(domainUri);

            // start
            nancyHost.Start();
            Console.WriteLine("REST service listening on " + DOMAIN);
            // stop with an <Enter> key press
            Console.ReadLine();
            nancyHost.Stop();
        }