0

I have a GRPC server written on C#.

internal class Program
    {
        internal static void Main(string[] args)
        {
            using (var waitHandle = new AutoResetEvent(false))
            {
                void OnConsoleOnCancelKeyPress(object o, ConsoleCancelEventArgs e)
                {
                    e.Cancel = true;

                    // ReSharper disable once AccessToDisposedClosure
                    waitHandle.Set();
                }

                Console.CancelKeyPress += OnConsoleOnCancelKeyPress;

                var config = new AppConfig(new ConfigurationBuilder()
                    .AddJsonFile("appsettings.json", false)
                    .Build());

                var containerBuilder = new ContainerBuilder();
                containerBuilder.RegisterModule(new Module());
                containerBuilder.RegisterModule(new Data.Module(config.Region, config.TablePrefix));

                using (var container = containerBuilder.Build())
                {
                    var buyRatesService = container.Resolve<BuyRatesService>();
                    var logger = container.Resolve<ILogger<Program>>();
                    var server = new Server
                    {
                        Services =
                        {
                            BuyRates.BindService(buyRatesService)
                        },
                        Ports = {new ServerPort("0.0.0.0", 50051, ServerCredentials.Insecure)}
                    };

                    try
                    {
                        server.Start();
                        logger.LogDebug("Service started");
                        waitHandle.WaitOne();
                    }
                    catch (Exception e)
                    {
                        logger.LogCritical("Application terminated unexpectedly. Exception {@exception}", e);
                    }
                    finally
                    {
                        server.ShutdownAsync().Wait();
                        Console.CancelKeyPress -= OnConsoleOnCancelKeyPress;
                    }
                }
            }
        }
    }

It works fine locally. I deploy it to ecs instance(Docker). The container port is 50051. ALB and Route 53 are used.

When I'm trying to connect to someroute54uri.net:50051 I get an error Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="Connect Failed").

In case when I'm trying to connect to someroute54uri.net, I get an error Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail="Trying to connect an http1.x server").

Thanks!.

Please, let me know if additional information helps to solve the issue.

AlexeyBogdan
  • 98
  • 10
  • Possible duplicate of [Deploy gRPC supporting application on AWS using ALB](https://stackoverflow.com/questions/50345084/deploy-grpc-supporting-application-on-aws-using-alb) –  Jun 25 '19 at 20:22
  • Yea it could be problem of Amazon's HTTP/2 support. See also https://github.com/grpc/grpc/issues/18710 – Muxi Jun 26 '19 at 17:41

0 Answers0