當前位置: 首頁>>代碼示例>>C#>>正文


C# SiloHost.StartOrleansSilo方法代碼示例

本文整理匯總了C#中Orleans.Runtime.Host.SiloHost.StartOrleansSilo方法的典型用法代碼示例。如果您正苦於以下問題:C# SiloHost.StartOrleansSilo方法的具體用法?C# SiloHost.StartOrleansSilo怎麽用?C# SiloHost.StartOrleansSilo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Orleans.Runtime.Host.SiloHost的用法示例。


在下文中一共展示了SiloHost.StartOrleansSilo方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Main

        private static void Main()
        {
            while (true)
            {
                Console.WriteLine("請輸入配置文件名稱:");
                var configName = Console.ReadLine();
                var configFile = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                    $"{Path.GetFileNameWithoutExtension(configName)}.xml"));
                if (!configFile.Exists)
                {
                    Console.WriteLine($"配置文件:{configFile.FullName},不存在!");
                    continue;
                }
                Console.WriteLine("請輸入節點名稱:");
                var nodeName = Console.ReadLine() ?? string.Empty;
                using (var host = new SiloHost(nodeName, configFile))
                {
                    host.LoadOrleansConfig();
                    host.InitializeOrleansSilo();
                    host.StartOrleansSilo();

                    Console.WriteLine("已啟動,按下任意鍵退出。");
                    Console.ReadLine();

                    host.StopOrleansSilo();
                }
                break;
            }
        }
開發者ID:andyshao,項目名稱:Samples-1,代碼行數:29,代碼來源:Program.cs

示例2: Run

        private static void Run()
        {
            var config = GetClusterConfiguration();
            config.Globals.SeedNodes.Add(new IPEndPoint(IPAddress.Loopback, 11111));
            config.Defaults.HostNameOrIPAddress = "localhost";
            config.Defaults.Port = 11111;
            config.Defaults.ProxyGatewayEndpoint = new IPEndPoint(IPAddress.Loopback, 12345);

            var process = Process.GetCurrentProcess();
            var name = Environment.MachineName + "_" + process.Id + Guid.NewGuid().ToString("N").Substring(3);

            var silo = new SiloHost(name, config);

            // Configure the silo for the current environment.
            silo.SetSiloType(Silo.SiloType.Primary);

            Trace.TraceInformation("Silo configuration: \n" + silo.Config.ToString(name));

            silo.InitializeOrleansSilo();
            Trace.TraceInformation("Successfully initialized Orleans silo '{0}' as a {1} node.", silo.Name, silo.Type);
            Trace.TraceInformation("Starting Orleans silo '{0}' as a {1} node.", silo.Name, silo.Type);

            if (silo.StartOrleansSilo())
            {
                silo.WaitForOrleansSiloShutdown();
            }
        }
開發者ID:OrleansContrib,項目名稱:Orleans.Consensus,代碼行數:27,代碼來源:Program.cs

示例3: InitSilo

        static void InitSilo(string[] args)
        {
            siloHost = new SiloHost(System.Net.Dns.GetHostName());
            // The Cluster config is quirky and weird to configure in code, so we're going to use a config file
            siloHost.ConfigFileName = "OrleansConfiguration.xml";

            siloHost.InitializeOrleansSilo();
            var startedok = siloHost.StartOrleansSilo();
            if (!startedok)
                throw new SystemException(String.Format("Failed to start Orleans silo '{0}' as a {1} node", siloHost.Name, siloHost.Type));
        }
開發者ID:jeoffman,項目名稱:OrleansStreamingTest,代碼行數:11,代碼來源:Program.cs

示例4: InitSilo

 private static void InitSilo(string[] args)
 {
     siloHost=new SiloHost(System.Net.Dns.GetHostName());
     siloHost.ConfigFileName = "OrleansConfiguration.xml";
     siloHost.InitializeOrleansSilo();
     var startedOk = siloHost.StartOrleansSilo();
     if (!startedOk)
     {
         throw new SystemException(String.Format("Failed to start Orleans silo '{0}' as a {1} node", siloHost.Name, siloHost.Type));
     }
 }
開發者ID:feizeikesi,項目名稱:Orleans,代碼行數:11,代碼來源:Program.cs

示例5: Main

        private static void Main(string[] args){
            using (SiloHost host = new SiloHost("Default")){
                host.LoadOrleansConfig();
                host.InitializeOrleansSilo();
                host.StartOrleansSilo();

                Console.WriteLine("Start--------");
                Console.ReadLine();

                host.StopOrleansSilo();
            }
        }
開發者ID:lzlzlz911,項目名稱:Orleans4Net,代碼行數:12,代碼來源:Program.cs

示例6: InitSilo

        static void InitSilo(string[] args)
        {
            siloHost = new SiloHost(System.Net.Dns.GetHostName());
            // possible from code, but easier via config
            siloHost.ConfigFileName = "OrleansConfiguration.xml";

            siloHost.InitializeOrleansSilo();
            var startedok = siloHost.StartOrleansSilo();
            if (!startedok)
            {
                throw new SystemException(String.Format("Failed to start silo '{0}' as '{1}' node", siloHost.Name, siloHost.Type));
            }
        }
開發者ID:saeedakhter,項目名稱:OrleansStrongConsistency,代碼行數:13,代碼來源:Program.cs

示例7: InitSilo

        static void InitSilo(string[] args)
        {
            _siloHost = new SiloHost(Dns.GetHostName())
            {
                ConfigFileName = "ServerConfiguration.xml"
            };

            _siloHost.InitializeOrleansSilo();

            var startedOk = _siloHost.StartOrleansSilo();

            if (!startedOk)
                throw new SystemException($"Failed to start Orleans silo '{_siloHost.Name}' as a {_siloHost.Type} node");
        }
開發者ID:legigor,項目名稱:talkach,代碼行數:14,代碼來源:Program.cs

示例8: InitSilo

 private static void InitSilo(string[] args)
 {
     _host = new SiloHost(Dns.GetHostName())
     {
         ConfigFileName = "OrleansConfiguration.xml"
     };
     _host.LoadOrleansConfig();
     _host.InitializeOrleansSilo();
     if (_host.StartOrleansSilo())
     {
         Console.WriteLine($"Started host {_host.Name} as a {_host.Type} node");
     }
     else
     {
         Console.WriteLine($"Failed to start host {_host.Name}");
     }
 }
開發者ID:malevy,項目名稱:dining-orleans,代碼行數:17,代碼來源:Program.cs

示例9: InitSilo

 private static void InitSilo(string[] args)
 {
     var configFile = Path.Combine(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location) , "OrleansConfiguration.xml"); 
     _host = new SiloHost(Dns.GetHostName())
     {
         ConfigFileName = configFile
     };
     _host.LoadOrleansConfig();
     _host.InitializeOrleansSilo();
     if (_host.StartOrleansSilo())
     {
         Console.WriteLine($"Started host {_host.Name} as a {_host.Type} node");
     }
     else
     {
         Console.WriteLine($"Failed to start host {_host.Name}");
     }
 }
開發者ID:malevy,項目名稱:Barker,代碼行數:18,代碼來源:Program.cs

示例10: InitSilo

        private static void InitSilo(String[] args)
        {
            Common.initConsoleLog();

            siloHost = new SiloHost(Dns.GetHostName())
            {
                ConfigFileName = "OrleansConfiguration.xml"
            };

            siloHost.InitializeOrleansSilo();
            if (!siloHost.StartOrleansSilo())
            {
                throw new Exception(
                    $"Failed to start Orleans silo '{siloHost.Name}' " +
                    $"as a {siloHost.Type} node"
                );
            }
        }
開發者ID:LadyLeia,項目名稱:exchange2crm,代碼行數:18,代碼來源:Program.cs

示例11: Main

        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("請輸入配置文件名稱:");
                var configName = Console.ReadLine();
                configName = string.IsNullOrEmpty(configName) ? "OrleansConfiguration" : configName;
                var configFile = new FileInfo(
                    Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                    string.Format("{0}.xml", configName)));
                if (!configFile.Exists)
                {
                    Console.WriteLine("配置文件:{0} 不存在", configFile.Name);
                    continue;
                }
                Console.WriteLine("請輸入節點名稱");
                var nodeName = Console.ReadLine() ?? string.Empty;

                using (var host = new SiloHost(nodeName, configFile))
                {
                    host.LoadOrleansConfig();
                    host.InitializeOrleansSilo();
                    host.StartOrleansSilo();

                    Console.WriteLine("已啟動,按下任意鍵退出");
                    Console.ReadLine();
                    host.StopOrleansSilo();
                }
            }
           
            //AppDomain hostDomain=AppDomain.CreateDomain("OrleansHost",null,new AppDomainSetup()
            //{
            //    AppDomainInitializer =InitSilo
            //});

            //DoSomeClientWork();
            //Console.WriteLine("Orleans Silo is running.\nPress Enter to terminate...");
            //Console.ReadLine();

            //hostDomain.DoCallBack(ShutdownSilo);
        }
開發者ID:feizeikesi,項目名稱:Orleans,代碼行數:41,代碼來源:Program.cs


注:本文中的Orleans.Runtime.Host.SiloHost.StartOrleansSilo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。