static async Task Main(string[] args) { await Task.Delay(1000 * 5); // waiting web service startup using var channel = GrpcChannel.ForAddress("https://localhost:5001"); var client = new Sample.SampleClient(channel); // this metadata object will send to grpc server(USE HTTP HEADERS) var meta = new Metadata(); meta.Add("Authorization", $"FAKE TOKEN"); // send user login info and metatdata var reply = client.Login( new SampleRequest { Account = "user", Password = "******" }, meta); // show login status Console.WriteLine("Login Result: " + reply.Verified); // keep console app running Console.ReadKey(); }
static void Main(string[] args) { Console.WriteLine("Started Calling......"); // Enable support for unencrypted HTTP2 AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); var channel = GrpcChannel.ForAddress("http://localhost:5000"); var client = new Sample.SampleClient(channel); var response = client.SayHello(new HelloRequest() { Name = "Vivek" }); Console.WriteLine(response.Message); }