Asp.net: 'application/grpc-web' is not supported

4k Views Asked by At

I had Asp.net core and gRPC working on the browser...but now I get:

info: Grpc.AspNetCore.Server.ServerCallHandler[2]
  Request content-type of 'application/grpc-web' is not supported.

Any ideas on how to track this down?

2

There are 2 best solutions below

1
On

Likely an issue in your Startup.cs

Yours should look something like this enter image description here

My guess is that you are missing app.UseGrpcWeb() or the EnabledGrpc() on the EndpointConventionBuilder

0
On

I ran across this issue. I had my app.UseGrpcWeb(); before app.UseRouting();

It had to be after.

So correct order is:

    app.UseRouting();
    app.UseGrpcWeb();

See https://learn.microsoft.com/en-us/aspnet/core/grpc/browser?view=aspnetcore-5.0 -- "Configure gRPC-Web in ASP.NET Core"