using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Orleans; using Orleans.Configuration; using Orleans.Hosting; using System; using System.Net; using System.Threading.Tasks; using w23082019.Default; namespace w23082019.Silo { class Program { static async Task<int> Main(string[] args) { try { var host = new HostBuilder() .UseOrleans((siloBuilder) => { siloBuilder .UseLocalhostClustering() .Configure<ClusterOptions>(options => { options.ClusterId = "dev"; options.ServiceId = "HelloWorldApp"; }) .Configure<EndpointOptions>(options => options.AdvertisedIPAddress = IPAddress.Loopback) .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(HelloOrleans).Assembly).WithReferences()); }) .ConfigureLogging(logging => logging.AddConsole()) .Build(); await host.RunAsync(); return 0; } catch (Exception ex) { Console.WriteLine(ex); return 1; } } } }
注意红标 扩展方法要用 有时智能提示不会补全