Пример #1
0
 static void SendMessage(IServiceProxy proxy, string message)
 {
     try
     {
         ss.SayHello(new HelloRequest()
         {
             Name = message
         });
     }
     catch (Exception ex)
     {
         Console.WriteLine($"异常   {ex.ToString()}");
     }
 }
Пример #2
0
        static void Main(string[] args)
        {
            var name = "Lucedy";

            using var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client = new GreeterClient(channel);

            var response = client.SayHello(new GrpcService.HelloRequest {
                Name = name
            });

            Console.WriteLine($"{response.Message}!");
            Console.ReadLine();
        }
Пример #3
0
        private static void Main(string[] args)
        {
            using var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client = new GreeterClient(channel);

            var request = new HelloRequest
            {
                Name = "your name"
            };

            var helloReply = client.SayHello(request);

            Console.WriteLine(helloReply.Message);
            Console.WriteLine("Hello World!");

            Console.ReadLine();
        }