public async Task <string> Get(string name)
        {
            var res = await _testClient.SayHelloAsync(new HelloRequest()
            {
                Name = name
            });

            return(res.Message);
        }
Exemple #2
0
        static async Task Main(string[] args)
        {
            // The port number(5001) must match the port of the gRPC server.
            using var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client = new Test.TestClient(channel);
            var reply  = await client.SayHelloAsync(
                new HelloRequest { Name = "TestClient" });

            Console.WriteLine("Greeting: " + reply.Message);
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }