Beispiel #1
0
        public static async Task Main(string[] args)
        {
            try
            {
                // register IPersonService proxy generated by ServiceModel.Grpc.DesignTime
                DefaultClientFactory.AddPersonServiceClient();

                Console.WriteLine("Call ServerAspNetCore");
                await Run(new Channel("localhost", ServiceConfiguration.AspNetCorePort, ChannelCredentials.Insecure));

                Console.WriteLine("Call ServerSelfHost");
                await Run(new Channel("localhost", ServiceConfiguration.SelfHostPort, ChannelCredentials.Insecure));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.WriteLine("...");
            Console.ReadLine();
        }
Beispiel #2
0
        public static async Task Main()
        {
            var aspNetCoreChannel = new Channel("localhost", SharedConfiguration.AspNetgRPCPersonServicePort, ChannelCredentials.Insecure);

            // register IPersonService proxy generated by ServiceModel.Grpc.DesignTime
            DefaultClientFactory.AddPersonServiceClient();
            var proxy = DefaultClientFactory.CreateClient <IPersonService>(aspNetCoreChannel);

            Console.WriteLine("-- call AspNetServiceHost --");
            await CallGet(proxy);
            await CallGetAll(proxy);

            var nativeChannel = new Channel("localhost", SharedConfiguration.NativegRPCPersonServicePort, ChannelCredentials.Insecure);

            proxy = DefaultClientFactory.CreateClient <IPersonService>(nativeChannel);

            Console.WriteLine();
            Console.WriteLine("-- call NativeServiceHost --");
            await CallGet(proxy);
            await CallGetAll(proxy);

            Console.WriteLine("...");
            Console.ReadLine();
        }