static void Main(string[] args) { Channel channel = new Channel("127.0.0.1:9007", ChannelCredentials.Insecure); var client = new gRPC.gRPCClient(channel); var reply = client.SayHello(new HelloRequest { Name = "Zhang San" }); Console.WriteLine("来自" + reply.Message); var reqult = client.Add(new AddRequest { A = 3, B = 5 }); Console.WriteLine(reqult.C); Console.WriteLine(reqult.Msg); var client2 = new QueryServie.QueryServieClient(channel); var resp = client2.query(new SearchRequest { Query = "", PageNumber = 1, ResultPerPage = 20, Corpus = SearchRequest.Types.Corpus.Web }); Console.WriteLine(resp); channel.ShutdownAsync().Wait(); Console.WriteLine("任意键退出..."); Console.ReadKey(); }
static void Main(string[] args) { Channel channel = new Channel("127.0.0.1:8082", ChannelCredentials.Insecure); var client = new gRPC.gRPCClient(channel); var reply = client.SayHello(new TestRequest { Name = "jeno" }); Console.WriteLine("2333 SayHello Return: " + reply.Message); var reply2 = client.Add(new AddTarget { V1 = 6, V2 = 7 }); Console.WriteLine("V1=6,V2=7 Add Return: " + reply2.Sum); channel.ShutdownAsync().Wait(); Console.WriteLine("任意键退出..."); Console.ReadKey(); }