我想用代码配置而不是XML文件配置来启动服务器,但是如果不调用LoadOrleansConfig方法,silo服务器就无法启动。
string providerName = "MySql.Data.MySqlClient";
string mysqlConnString = "mysqlConnString";
var config = new ClusterConfiguration();
config.Globals.DeploymentId = "OrleansTest";
config.Globals.AdoInvariant = providerName;
config.Globals.DataConnectionString = mysqlConnString;
config.Globals.LivenessType = LivenessProviderType.Custom;
config.Globals.ReminderServiceType = ReminderServiceProviderType.Custom;
config.Globals.MembershipTableAssembly = "OrleansSQLUtils";
config.Globals.ReminderTableAssembly = "OrleansSQLUtils";
config.Defaults.HostNameOrIPAddress = "localhost";
config.Defaults.Port = 11111;
config.Defaults.ProxyGatewayEndpoint = new IPEndPoint(IPAddress.Loopback, 30000);
using (var host = new SiloHost("Default"))
{
host.Config = config;
host.InitializeOrleansSilo();
var result = host.StartOrleansSilo();
Console.WriteLine("server startup {0}", result ? "successful" : "failure");
Console.ReadLine();
host.StopOrleansSilo();
}