-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
29 lines (25 loc) · 1.08 KB
/
Program.cs
File metadata and controls
29 lines (25 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Net;
await Host.CreateDefaultBuilder(args)
.UseOrleans((ctx, siloBuilder) =>
{
// In order to support multiple hosts forming a cluster, they must listen on different ports.
// Use the --InstanceId X option to launch subsequent hosts.
var instanceId = ctx.Configuration.GetValue<int>("InstanceId");
var port = 11_111;
siloBuilder.UseLocalhostClustering(
siloPort: port + instanceId,
gatewayPort: 30000 + instanceId,
primarySiloEndpoint: new IPEndPoint(IPAddress.Loopback, port));
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.ConfigureKestrel((ctx, kestrelOptions) =>
{
// To avoid port conflicts, each Web server must listen on a different port.
var instanceId = ctx.Configuration.GetValue<int>("InstanceId");
var port = ctx.Configuration.GetValue<int>("PORT");
kestrelOptions.ListenAnyIP(port + instanceId);
});
})
.RunConsoleAsync();