static async Task Main(string[] args) { var server = new Grpc.Core.Server { Services = { GreeterService.BindService(new GreeterServiceImplementation()) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("Greeter server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); await server.ShutdownAsync(); }
static async Task Main(string[] args) { var server = new Grpc.Core.Server { Services = { ServerReflection.BindService(new ReflectionServiceImpl(GreeterServiceReflection.Descriptor.Services)), Health.BindService(new HealthServiceImpl()), GreeterService .BindService(new GreeterServiceImplementation()) .Intercept(new SimpleInterceptor()) }, Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("Greeter server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); await server.ShutdownAsync(); }