Reputation: 31
When client and server work on same pc they connect fine.
Next situation is server on real pc, client on VirtualBox. Both devices have Windows 10. Firewall is disabled on server. When client tries to connet to server exception occurs:
Grpc.Core.RpcException: 'Status(StatusCode="Internal", Detail="Error starting gRPC call.
Client code:
public ThermocyclerClient()
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
var httpClientHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
var httpClient = new HttpClient(httpClientHandler);
var channel = GrpcChannel.ForAddress("http://192.168.111.189:7001", new GrpcChannelOptions { HttpClient = httpClient });
client = new ThermocyclerRpcService.ThermocyclerRpcServiceClient(channel);
}
Server code:
server = new Server
{
Ports = { new ServerPort("localhost", 7001, ServerCredentials.Insecure) },
Services =
{
ExtractorRpcService.BindService(this.extractorService),
ThermocyclerRpcService.BindService(this.thermocyclerService)
}
};
Why client can't connect to server?
Real pc and VirtualBox ping each over successfully.
Upvotes: 1
Views: 815
Reputation: 31
The correct answer was given by Marc Gravell in comments. Changing from localhost to computer name has helped. "0.0.0.0" in host name also works (thanks to zanseb).
Upvotes: 2