示例#1
0
        static async Task Main(string[] args)
        {
            // This switch must be set before creating the GrpcChannel/HttpClient.
            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

            var channel = GrpcChannel.ForAddress("http://localhost:50051");
            var client  = new GreeterService.GreeterServiceClient(channel);
            var reply   = await client.SayHelloAsync(new HelloRequest { Name = "GreeterClient" });

            Console.WriteLine("Greeting: " + reply.Message);
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
示例#2
0
        static async Task Main(string[] args)
        {
            var channel = new Channel("localhost:50051", ChannelCredentials.Insecure);

            var client = new GreeterService.GreeterServiceClient(channel);
            var user = "******";

            var reply = await client.SayHelloAsync(new HelloRequest { Name = user });
            Console.WriteLine("Greeting: " + reply.Message);

            await channel.ShutdownAsync();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
示例#3
0
        static async Task Main(string[] args)
        {
            var channel = new Channel("localhost:3005", ChannelCredentials.Insecure);
            var client  = new GreeterService.GreeterServiceClient(channel);

            var reply = await client.SayHelloAsync(
                new HelloRequest { Name = "Client" },
                new Metadata { { "client-name", "extensibility greeter" } });

            Console.WriteLine("Reply: " + reply.Reply);

            await channel.ShutdownAsync();

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }