My GRPC client throws the following exception talking to my server. I gather the exception means that a connection was established but the server errored?
Grpc.Core.RpcException: 'Status(StatusCode="Unavailable", Detail="Empty update", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1615327484.993000000","description":"Failed to pick subchannel","file":"......\src\core\ext\filters\client_channel\client_channel.cc","file_line":5397,"referenced_errors":[{"created":"@1615327484.993000000","description":"Empty update","file":"......\src\core\ext\filters\client_channel\lb_policy\pick_first\pick_first.cc","file_line":201,"grpc_status":14}]}")'
The server is configured as follows. Am I missing something from the recipie?
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel(options =>
{
options.Listen(IPAddress.Loopback, BINDING_PORT, configure =>
{
configure.UseHttps(GetCertificate());
configure.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http2;
});
});
webBuilder.UseStartup<Startup>();
}).UseWindowsService();
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGrpcService<LicenseService>().RequireHost($"*:{Program.BINDING_PORT}");
endpoints.MapGet("/", async context =>
{
await context.Response.WriteAsync("Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
});
});
}
I notice the server initializes via BindService, but the serviceImpl is null. Is that expected?
public static void BindService(grpc::ServiceBinderBase serviceBinder, LicensesBase serviceImpl)
{
serviceBinder.AddMethod(__Method_GetLicense, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::LicenseService.LicRequest, global::LicenseService.LicReply>(serviceImpl.GetLicense));
}