Beispiel #1
0
        public async Task Start()
        {
            server = new Server
            {
                Services = { HelloSrv.BindService(new HelloServiceImpl()) },
                Ports    = { new ServerPort("172.16.89.139", 50088, ServerCredentials.Insecure) }
            };

            await Task.Run(() => {
                server.Start();
            });
        }
Beispiel #2
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            logger.LogInformation("服务启动...");
            gRPC = new Server
            {
                Services = { HelloSrv.BindService(server) },
                Ports    = { new ServerPort("0.0.0.0", 50088, ServerCredentials.Insecure) }
            };
            gRPC.Start();

            Console.WriteLine("Greeter server listening on port " + 50088);
            Console.WriteLine("Press any key to stop the server...");
            await Task.CompletedTask;
        }