dotnet network_error ai_generated true

Grpc.Core.RpcException: Status(StatusCode="Unavailable", Detail="failed to connect to all addresses; last error: UNKNOWN: Connection reset")

ID: dotnet/grpc-unavailable-connection-reset

Also available as: JSON · Markdown · 中文
82%Fix Rate
85%Confidence
1Evidence
2023-03-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
dotnet 6.0 active
dotnet 8.0 active
Grpc.Core 2.46 active
Grpc.Net.Client 2.60 active

Root Cause

gRPC client cannot establish or maintain a connection to the server, often due to server unavailability, network issues, or TLS configuration mismatches.

generic

中文

gRPC 客户端无法建立或维持与服务器的连接,通常由服务器不可用、网络问题或 TLS 配置不匹配引起。

Official Documentation

https://learn.microsoft.com/en-us/aspnet/core/grpc/troubleshoot?view=aspnetcore-8.0#connection-reset

Workarounds

  1. 90% success Verify server health and network connectivity. Use tools like grpcurl to test the endpoint. Example: grpcurl -insecure <server>:<port> list.
    Verify server health and network connectivity. Use tools like grpcurl to test the endpoint. Example: grpcurl -insecure <server>:<port> list.
  2. 85% success Ensure TLS certificates are valid and trusted. If using self-signed certs in dev, set GrpcChannelOptions.HttpHandler to bypass validation.
    Ensure TLS certificates are valid and trusted. If using self-signed certs in dev, set GrpcChannelOptions.HttpHandler to bypass validation.
  3. 80% success Check firewall and load balancer settings to ensure gRPC port (usually 5001) is open and HTTP/2 is supported.
    Check firewall and load balancer settings to ensure gRPC port (usually 5001) is open and HTTP/2 is supported.

中文步骤

  1. Verify server health and network connectivity. Use tools like grpcurl to test the endpoint. Example: grpcurl -insecure <server>:<port> list.
  2. Ensure TLS certificates are valid and trusted. If using self-signed certs in dev, set GrpcChannelOptions.HttpHandler to bypass validation.
  3. Check firewall and load balancer settings to ensure gRPC port (usually 5001) is open and HTTP/2 is supported.

Dead Ends

Common approaches that don't work:

  1. 80% fail

    gRPC requires secure connections in production; disabling TLS can cause security warnings or failures if server enforces HTTPS.

  2. 90% fail

    Retries will continue to fail if the server is down or firewall blocks the port.

  3. 70% fail

    Does not fix the connection issue; just delays the timeout error.