AnswerBun.com

My gRPC-Test Project just work on localhost

i have the following problem.

I created a gRpc Server(Console App .Net 4.7.2 – i cant do Net Core on Server Side because of Crystal Reports 🙁) and a Client(WPF App .Net Core 3.1) and i can run it as long as Server and Client are on my machine (Windows 10). As far es i take my Server to another machine (windows Server 2016), it does not work anymore.

this is the RPC Exception:

Status(StatusCode="Unavailable", Detail="failed to connect to all
addresses",
DebugException="Grpc.Core.Internal.CoreErrorDetailException:
{"created":"@1595508082.170000000","description":"Failed to pick
subchannel","file":"T:srcgithubgrpcworkspace_csharp_ext_windows_x64srccoreextfiltersclient_channelclient_channel.cc","file_line":3948,"referenced_errors":[{"created":"@1595508082.170000000","description":"failed
to connect to all
addresses","file":"T:srcgithubgrpcworkspace_csharp_ext_windows_x64srccoreextfiltersclient_channellb_policypick_firstpick_first.cc","file_line":394,"grpc_status":14}]}")

i tried all variations. Here is my lastcode that works on localhost:

Server:

static void Main(string[] args)
    {
        var cacert = File.ReadAllText(@"root.crt");
        var servercert = File.ReadAllText(@"server.crt");
        var serverkey = File.ReadAllText(@"server.key");
        var keypair = new KeyCertificatePair(servercert, serverkey);
        var sslCredentials = new SslServerCredentials(new List<KeyCertificatePair>() { keypair }, cacert, false);

        // Build a server
        var server = new Server
        {
            Services = { ReportService.BindService(new KKarteReportService()) },
            Ports = { new ServerPort(Host, Port, sslCredentials) }
        };


        // Start server
        server.Start();

        Console.WriteLine("KKarteReport Server listening on port " + Port);
        Console.WriteLine("Press any key to stop the server...");
        Console.ReadKey();

        server.ShutdownAsync().Wait();
    }

Client

var cacert = File.ReadAllText(@"root.crt");
var clientcert = File.ReadAllText(@"client.crt");
var clientkey = File.ReadAllText(@"client.key");
var ssl = new SslCredentials(cacert, new KeyCertificatePair(clientcert, clientkey));
           
 var options = new List<ChannelOption> { new ChannelOption(ChannelOptions.SslTargetNameOverride, "MyServerHost") }; 
 var channel = new Channel("12.20.18.11", 5001, ssl, options);
 //var channel = new Channel("localhost", 5001, ssl, options);
 //var channel = new Channel(url, ChannelCredentials.Insecure);
 var client = new ReportService.ReportServiceClient(channel);

  using var streamingCall = client.CreateAusschreibung(request);

  await using var ms = new MemoryStream();

  while (await streamingCall.ResponseStream.MoveNext())
  {
        ms.Write(streamingCall.ResponseStream.Current.FileChunk.ToByteArray());
  }

What do i miss?

Stack Overflow Asked by blindmeis on January 2, 2021

1 Answers

One Answer

What does the ‘Host‘ variable contain on the server side? The issue might be a incorrect address binding, which prevents the service from being reachable from IP addresses other than localhost (127.0.0.1). Try entering 0.0.0.0 there.

Answered by CoffeeCodeConverterImpl on January 2, 2021

Add your own answers!

Related Questions

Getting date for calculation

1  Asked on December 12, 2020 by faizan-gauhar

   

Map bash table output to array

1  Asked on December 12, 2020 by jeroen-smink

         

How Can i fetch all data with average rating in laravel

1  Asked on December 12, 2020 by nadun-silva

         

Multiple conditions in SELECT Statement

1  Asked on December 12, 2020 by rick-smith

 

Set up different CORS rules based on the endpoint in Django

2  Asked on December 12, 2020 by augusto-samam-barrientos

     

Angular check and uncheck boxes from data

1  Asked on December 12, 2020 by mg91

 

how do i switch a condition based on bind variable

1  Asked on December 12, 2020 by vivek

   

Comparing two triangles in C (3, 3, 4 and 4, 3, 3 for example)

3  Asked on December 12, 2020 by etoile

 

Grouping unique values with low value counts

1  Asked on December 12, 2020 by yupper

 

Why should I press ENTER before CTRL+D to indicate an EOF to stdin?

1  Asked on December 11, 2020 by name-null

         

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.