【问题标题】:ASP.NET Core grpc-Web on IIS returns 404IIS 上的 ASP.NET Core grpc-Web 返回 404
【发布时间】:2020-11-18 06:56:04
【问题描述】:

.NET Core gRPC-Web 客户端在 http://localhost:5000 上调用 ASP.NET Core gRPC-Web 服务器工作正常。

将相同的客户端代码调用服务器部署到具有虚拟应用程序(例如,“http://build.mycompany.ca/myapp”)的 IIS 服务器会导致

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

我的 ASP.NET Core 3.1 服务器设置正确。 IE。, app.UseGrpcWeb(new GrpcWebOptions { DefaultEnabled = true });

介于两者之间

app.UseRouting()

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

任何想法我在这里缺少什么?

【问题讨论】:

    标签: asp.net-core grpc grpc-web


    【解决方案1】:

    Grpc 客户端仅使用 URI 的主机部分。需要 DelegatingHandler 才能重定向到目标主机上的子目录。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-10
      • 1970-01-01
      • 2020-10-20
      • 2021-02-01
      • 2018-06-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多