I get the following error when trying to open my Postgresql database using C # utility:
System.IO.IOException: cannot read data from transport connection: existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: existing connection was forcibly closed by the remote host
I tried to run this program from a remote computer and from the computer running the Postgresql server.
There are currently no firewalls on any computer, and I can connect to the database and server simply through the postgres admin utility using the same password. I checked that the username has permissions for the database.
Here is my connection code:
public bool updateFromServer()
{
try
{
NpgsqlConnection conn = new NpgsqlConnection(connString);
conn.Open();
conn.Close();
return true;
}
catch (Exception e)
{
conn.close()
return false;
}
}
Any help with this would be appreciated.
source
share