本文整理汇总了C#中Orleans.Runtime.Host.SiloHost.InitializeOrleansSilo方法的典型用法代码示例。如果您正苦于以下问题:C# SiloHost.InitializeOrleansSilo方法的具体用法?C# SiloHost.InitializeOrleansSilo怎么用?C# SiloHost.InitializeOrleansSilo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orleans.Runtime.Host.SiloHost
的用法示例。
在下文中一共展示了SiloHost.InitializeOrleansSilo方法的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;
}
}
示例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();
}
}
示例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));
}
示例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));
}
}
示例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();
}
}
示例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));
}
}
示例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");
}
示例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}");
}
}
示例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}");
}
}
示例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"
);
}
}
示例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);
}