Example #1
0
        static void Main(string[] args)
        {
            // You may need to configure the Windows Namespace reservation to assign
            // rights to use the port that you set below.
            // See: https://github.com/NancyFx/Nancy/wiki/Self-Hosting-Nancy
            // Use cmd.exe or PowerShell in Administrator mode with the following command:
            // netsh http add urlacl url=http://+:80/ user=Everyone
            // netsh http add urlacl url=https://+:443/ user=Everyone
#if DEBUG
            int  port  = 80;
            bool https = false;
#else
            int  port  = 443;
            bool https = true;
#endif
            Topshelf.HostFactory.Run(x =>
            {
                x.AddCommandLineDefinition("port", p => port   = int.Parse(p));
                x.AddCommandLineDefinition("https", b => https = bool.Parse(b));
                x.ApplyCommandLine();
                x.SetStartTimeout(new TimeSpan(0, 1, 0));
                x.Service <NancySelfHost>(s =>
                {
                    s.ConstructUsing(name => new NancySelfHost());
                    s.WhenStarted(tc => tc.Start(https, port));
                    s.WhenStopped(tc => tc.Stop());
                });
                x.RunAsPrompt();
                //x.RunAsLocalService();
                x.SetDisplayName("RhinoCommon Geometry Server");
                x.SetServiceName("RhinoCommon Geometry Server");
            });
            RhinoLib.ExitInProcess();
        }
Example #2
0
 static void Main(string[] args)
 {
     try
     {
         RhinoLib.LaunchInProcess(RhinoLib.LoadMode.Headless, 0);
         MeshABrep();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     Console.WriteLine("press any key to exit");
     Console.ReadKey();
     RhinoLib.ExitInProcess();
 }
Example #3
0
        static void Main(string[] args)
        {
            Logging.Init();
            int backendPort = Env.GetEnvironmentInt("COMPUTE_BACKEND_PORT", 8081);

            Topshelf.HostFactory.Run(x =>
            {
                x.UseSerilog();
                x.ApplyCommandLine();
                x.SetStartTimeout(new TimeSpan(0, 1, 0));
                x.Service <NancySelfHost>(s =>
                {
                    s.ConstructUsing(name => new NancySelfHost());
                    s.WhenStarted(tc => tc.Start(backendPort));
                    s.WhenStopped(tc => tc.Stop());
                });
                x.RunAsPrompt();
                //x.RunAsLocalService();
                x.SetDisplayName("compute.geometry");
                x.SetServiceName("compute.geometry");
            });
            RhinoLib.ExitInProcess();
        }