Esempio n. 1
0
 public static void Start()
 {
     _server = new Server
     {
         Services = { MsgService.BindService(new MsgServiceImpl()) },
         Ports    = { new ServerPort("localhost", 40001, ServerCredentials.Insecure) }
     };
     _server.Start();
 }
Esempio n. 2
0
        public void Start()
        {
            _server = new Server
            {
                Services = { MsgService.BindService(new MsgServiceImpl()) },
                Ports    = { new ServerPort(GrpcSettings.Value.IP, GrpcSettings.Value.Port, ServerCredentials.Insecure) }
            };
            _server.Start();

            Console.WriteLine($"Grpc ServerListening On Port {GrpcSettings.Value.Port}");
        }
        public static void Main(string[] args)
        {
            Server _server = new Server
            {
                Services = { MsgService.BindService(new MsgServiceImpl()) },
                Ports    = { new ServerPort("127.0.0.1", 40001, ServerCredentials.Insecure) }
            };

            _server.Start();

            CreateWebHostBuilder(args)
            .UseUrls($"http://127.0.0.1:8080")
            .Build().Run();
        }
Esempio n. 4
0
        public static void Start()
        {
            _server = new Server
            {
                Services = { MsgService.BindService(new MsgServiceImpl()) },
                Ports    = { new ServerPort("localhost", 40001, ServerCredentials.Insecure) }
            };
            _server.Start();

            Console.WriteLine("grpc ServerListening On Port 40001");
            Console.WriteLine("任意键退出...");
            Console.ReadKey();

            _server?.ShutdownAsync().Wait();
        }