Ejemplo n.º 1
0
 public void Wait_120000()
 {
     try
     {
         output.WriteLine("Hello World!");
         System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();
         binding.MaxBufferSize          = int.MaxValue;
         binding.ReaderQuotas           = System.Xml.XmlDictionaryReaderQuotas.Max;
         binding.MaxReceivedMessageSize = int.MaxValue;
         binding.SendTimeout            = new TimeSpan(0, 5, 0);
         binding.OpenTimeout            = new TimeSpan(0, 5, 0);
         binding.CloseTimeout           = new TimeSpan(0, 5, 0);
         binding.ReceiveTimeout         = new TimeSpan(0, 5, 0);
         binding.AllowCookies           = true;
         binding.TransferMode           = TransferMode.StreamedResponse;
         EndpointAddress addressEndpoint =
             new EndpointAddress("http://localhost:50703/SayHelloService.svc");
         SayHelloServiceClient client = new SayHelloServiceClient(binding, addressEndpoint);
         client.OpenAsync().GetAwaiter().GetResult();
         var channel = client.InnerChannel;
         client.InnerChannel.OperationTimeout = TimeSpan.FromMinutes(10);
         var result = client.ServiceAsyncMethodAsync("hi").Result;
         output.WriteLine(result);
     }
     catch (Exception ex)
     {
         output.WriteLine(ex.Message);
     }
 }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            using (var channel = GrpcChannel.ForAddress("https://localhost:50000"))
            {
                var client = new SayHelloServiceClient(channel);
                var reply  = await client.SayHelloAsync(new HelloRequest()
                {
                    Name = "Name"
                });

                Console.WriteLine("Press any key to finish...");
                Console.ReadKey();
            }
        }
Ejemplo n.º 3
0
        static async Task Main(string[] args)
        {
            var port = 50000;

            var channel = new Channel($"127.0.0.1:{port}", ChannelCredentials.Insecure);
            var client  = new SayHelloServiceClient(channel);

            var reply = await client.SayHelloAsync(new HelloRequest()
            {
                Name = "Name"
            });

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