I have a GRPC service written in ASP.NET Core 5.0 and I wanted to add a classic REST controller to explore its inner status during the development phase.
Unfortunately, I am experiencing some issues with routing.
This is the relevant endpoint section of the Startup
class
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapGrpcService<TestProviderService>();
endpoints.MapGet("/", async context =>
{
context.Response.Redirect("/docs/index.html");
});
});
The controller is accessible when hitting /values/
but it can't find the action when trying to explore a specific resource /values/123
or /values/1234/2345
. (In my real case, the IDs are GUIDs, not integers, if it makes any difference).
Everything works as expected when I comment out
endpoints.MapGrpcService<TestProviderService>();
I also tried to enable HTTP 1 and HTTP 2 side by side by doing
webBuilder.UseStartup<Startup>()
.ConfigureKestrel(options => options.ConfigureEndpointDefaults(o => o.Protocols = HttpProtocols.Http1AndHttp2));
But it didn't help either.
Thanks for your help!