ASP.NET Core grpc-Web on IIS returns 404
Asked Answered
C

1

8

.NET Core gRPC-Web client calling ASP.NET Core gRPC-Web server on http://localhost:5000 works fine.

Same client code calling server deployed to an IIS server with a virtual application (e.g., "http://build.mycompany.ca/myapp") results in

Status(StatusCode="Unimplemented", Detail="Bad gRPC response. HTTP status code: 404")

My ASP.NET Core 3.1 server is set up correctly. i.e., app.UseGrpcWeb(new GrpcWebOptions { DefaultEnabled = true });

is in between

app.UseRouting()

and

app.UseEndpoints(endpoints => {
    endpoints.MapControllers();
    endpoints
        .MapGrpcService<GrpcClientService>()
        .EnableGrpcWeb();
});

Any ideas what I'm missing here?

Cubic answered 28/7, 2020 at 18:43 Comment(1)
Did you find out how to fix this, I'm having the same problemRevel
C
2

only the host portion of the URI is used in the Grpc client. A DelegatingHandler is required to redirect to a subdirectory on the target host.

https://github.com/grpc/grpc-dotnet/issues/880

Cubic answered 28/7, 2020 at 20:57 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.