Search code examples
c#asp.net-coregrpchttp2http-1.1

Is it possible to use gRPC with HTTP/1.1 in .NET Core?


I have two network services - a gRPC client and gRPC server. Server is written in .NET Core, hence HTTP/2 for gRPC is enforced. Client however is a .NET Framework 4.7.2 web app hosted on IIS 8.5, so it only supports HTTP/1.1.

Since it will take some time to upgrade the client I was thinking if it is possible to use HTTP/1.1 instead of HTTP/2 on the server side, but I cannot find any information how to achieve that.

Is it possible to use HTTP/1.1 for gRPC server written in .NET Core? And if so - how?


Solution

  • No, you cannot use gRPC on HTTP 1.1; you may be able to use the Grpc.Core Google transport implementation, however, instead of the managed Microsoft bits; this targets .NET Standard 1.5 and .NET Standard 2.0, so should work on .NET Core, and uses an OS-specific unmanaged binary (chttp2) for the transport.

    For client-side, there is virtually no difference between the two; only the actual channel creation changes, between:

    GrpcChannel.ForAddress(...)
    

    with the Microsoft transport, and

    new Channel(...)
    

    with the Google transport. All of the rest of the APIs are shared (in Grpc.Core.Api)