Closed aminebizid closed 4 years ago
Yes it is. gRPC is just HTTP/2
Any example please I'm trying this on my Mac => gRPC works great but Swagger stopped working
public void ConfigureServices(IServiceCollection services)
{
services.AddGrpc();
services.AddControllers();
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseEndpoints(endpoints =>
{
endpoints.MapGrpcService<GreeterService>();
endpoints.MapControllers();
});
app.UseSwagger(_configuration);
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel(options =>
{
// Setup a HTTP/2 endpoint without TLS.
options.ListenLocalhost(5000, o => o.Protocols =
HttpProtocols.Http2);
options.ListenLocalhost(5001, o => o.Protocols =
HttpProtocols.Http1);
});
webBuilder.UseStartup<Startup>();
})
It was swagger misconfig. Thanks
Hi, Both rest and Grpc works with kestrel configuration but this configuration does not work on Docker(grpc) . I am using docker desktop. any ideas / suggestion.
Hi David, Is it possible to run a gRPC server and a swagger on the same Kestrel instance? Thank