Skip to content

Instantly share code, notes, and snippets.

@Kritner
Created October 7, 2018 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kritner/ffbdb25bba4f25dd4194f0d4022701d0 to your computer and use it in GitHub Desktop.
Save Kritner/ffbdb25bba4f25dd4194f0d4022701d0 to your computer and use it in GitHub Desktop.
Orleans getting started part 0, server config
public class Program
{
public static int Main(string[] args)
{
return RunMainAsync().Result;
}
private static async Task<int> RunMainAsync()
{
try
{
var host = await StartSilo();
Console.WriteLine("Press Enter to terminate...");
Console.ReadLine();
await host.StopAsync();
return 0;
}
catch (Exception ex)
{
Console.WriteLine(ex);
return 1;
}
}
private static async Task<ISiloHost> StartSilo()
{
// define the cluster configuration
var builder = new SiloHostBuilder()
.UseLocalhostClustering()
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "dev";
options.ServiceId = "HelloWorldApp";
})
.Configure<EndpointOptions>(options => options.AdvertisedIPAddress = IPAddress.Loopback)
.ConfigureLogging(logging => logging.AddConsole());
var host = builder.Build();
await host.StartAsync();
return host;
}
}
@Kritner
Copy link
Author

Kritner commented Oct 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment