diff --git a/aspnetcore/grpc/troubleshoot.md b/aspnetcore/grpc/troubleshoot.md index cc22f6aa42..a5f03ea2b6 100644 --- a/aspnetcore/grpc/troubleshoot.md +++ b/aspnetcore/grpc/troubleshoot.md @@ -70,19 +70,24 @@ var client = new Greet.GreeterClient(channel); ## Call insecure gRPC services with .NET Core client -When an app is using .NET Core 3.x, additional configuration is required to call insecure gRPC services with the .NET Core client. The gRPC client must set the `System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport` switch to `true` and use `http` in the server address: +The .NET gRPC client can call insecure gRPC services by specifing `http` in the server address. For example, `GrpcChannel.ForAddress("http://localhost:5000")`. -```csharp -// This switch must be set before creating the GrpcChannel/HttpClient. -AppContext.SetSwitch( - "System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); +There are some additional requirements to call insecure gRPC services depending on the .NET version an app is using: -// The port number(5000) must match the port of the gRPC server. -var channel = GrpcChannel.ForAddress("http://localhost:5000"); -var client = new Greet.GreeterClient(channel); -``` +* .NET 5 or later requires [Grpc.Net.Client](https://www.nuget.org/packages/Grpc.Net.Client) version 2.32.0 or later. +* .NET Core 3.x requires additional configuration. The app must set the `System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport` switch to `true`: + + ```csharp + // This switch must be set before creating the GrpcChannel/HttpClient. + AppContext.SetSwitch( + "System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); + + // The port number(5000) must match the port of the gRPC server. + var channel = GrpcChannel.ForAddress("http://localhost:5000"); + var client = new Greet.GreeterClient(channel); + ``` -.NET 5 apps don't need additional configuration, but to call insecure gRPC services they must use `Grpc.Net.Client` version 2.32.0 or later. +The `System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport` switch is only required for .NET Core 3.x. It does nothing in .NET 5 and isn't required. ## Unable to start ASP.NET Core gRPC app on macOS