# Grpc.Core.RpcException: Status(StatusCode="Unavailable", Detail="failed to connect to all addresses; last error: UNKNOWN: ipv4:192.168.1.1:443: No connection could be made because the target machine actively refused it.")

- **ID:** `dotnet/grpc-unavailable-connectivity`
- **Domain:** dotnet
- **Category:** network_error
- **Error Code:** `Unavailable`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The gRPC client cannot reach the server because the server is not running, the port is blocked by a firewall, or the endpoint address is incorrect.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| net6.0 | active | — | — |
| net7.0 | active | — | — |
| net8.0 | active | — | — |
| net9.0 | active | — | — |

## Workarounds

1. **Verify the server is running and listening on the expected port. Use 'netstat -an | findstr :443' (Windows) or 'ss -tuln | grep 443' (Linux) to check. Restart the gRPC server service if needed.** (90% success)
   ```
   Verify the server is running and listening on the expected port. Use 'netstat -an | findstr :443' (Windows) or 'ss -tuln | grep 443' (Linux) to check. Restart the gRPC server service if needed.
   ```
2. **Check firewall rules. For Windows, run 'netsh advfirewall firewall add rule name="gRPC" dir=in action=allow protocol=TCP localport=443'. For Linux, use 'ufw allow 443/tcp' or adjust iptables.** (85% success)
   ```
   Check firewall rules. For Windows, run 'netsh advfirewall firewall add rule name="gRPC" dir=in action=allow protocol=TCP localport=443'. For Linux, use 'ufw allow 443/tcp' or adjust iptables.
   ```
3. **Ensure the client endpoint URL matches the server's listening address. For example, if the server uses 'https://localhost:5001', the client should set 'new GrpcChannel.ForAddress("https://localhost:5001")'. Use DNS resolution with 'nslookup server.example.com' to verify IP.** (80% success)
   ```
   Ensure the client endpoint URL matches the server's listening address. For example, if the server uses 'https://localhost:5001', the client should set 'new GrpcChannel.ForAddress("https://localhost:5001")'. Use DNS resolution with 'nslookup server.example.com' to verify IP.
   ```

## Dead Ends

- **Increasing the deadline or timeout in the gRPC call** — The server is not responding at all; a longer timeout only delays the failure but does not establish a connection. (95% fail)
- **Disabling SSL/TLS on the client side** — If the server requires HTTPS, disabling TLS will cause a different error (e.g., protocol mismatch), not fix the connection refusal. (80% fail)
- **Changing the port number arbitrarily** — Unless the correct port is used, the connection will still be refused; this is a guess rather than a fix. (90% fail)
