使用OpenTelemetry时报grpc调用错误的处理方式
报错信息
InvalidOperationException: Calling insecure gRPC services on .NET Core 3.x requires enabling the'System.Net.Http.socketsHittpHandler.Http2Unencryptedsupport switch. See: https://learn.microsoft.com/zh-cn/aspnet/core/grpc/troubleshoot?view=aspnetcore-8.0#call-insecure-grpc-services-with-net-core-client
在程序启动入口加入如下配置
// This switch must be set before creating the GrpcChannel/HttpClient.
AppContext.SetSwitch(
"System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

浙公网安备 33010602011771号