System.Net.Sockets.SocketException (111): Connection refused
See original GitHub issueThe issue
I’m trying to run my migration scripts using dotnet ef database update...
but keep getting System.Net.Sockets.SocketException (111)
errors. Before you jump to conclusions, I am able to successfully connect to the remote database using psql psql -h <host> -p <port> -U <username> -W <password> <database>
.
System.Net.Sockets.SocketException (111): Connection refused
at Npgsql.NpgsqlConnector.Connect(NpgsqlTimeout timeout) in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 703
at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 555
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) in C:\projects\npgsql\src\Npgsql\NpgsqlConnector.cs:line 414
Further technical details
Npgsql version: 2.1.2 PostgreSQL version: 12 dotnet core version: 2.2.202 Operating system (remote): Windows Server 2012R2 Operating system (local): Ubuntu 18.04.4 LTS
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
"Application startup exception: System.Net.Sockets. ...
"Application startup exception: System.Net.Sockets.SocketException (111): Connection refused" with docker-compose ; "3.7" networks: kitchen-table ...
Read more >[Solved]-"Application startup exception: System.Net.Sockets ...
Coding example for the question "Application startup exception: System.Net.Sockets.SocketException (111): Connection refused" with docker-compose-docker.
Read more >What is ConnectionRefusedError Errno 111 Connection ...
The ConnectionRefusedError errno 111 connection refused is a socket error that results when there is a failure in the establishment of ...
Read more >Dotnet inside Docker giving Connection Refused error
Net.Sockets.SocketException (111): Connection refused digital-twin-api | at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 ...
Read more >SSH session in browser (Kudu): An error occurred while ...
System.Net.Sockets.SocketException (111): Connection refused at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
“Connection refused” means that a socket connection could not be established - Npgsql doesn’t do anything special here, just uses the standard networking APIs. In other words, this is almost surely some sort of environmental issue that’s unrelated to Npgsql - firewall, bad docker config, etc. As a first step it’s always good to try to connect with psql (or any other PostgreSQL client).
Am going to close this for now, because I don’t have any clear information about a problem in Npgsql.
I’m having the same issue. I also created separate network and tried to access the machines using their hostnames defined in docker-compose.yml. No luck. Getting exact same issue. System.Net.Sockets.SocketException (111): Connection refused