title: npgsql trouble in c# app - An existing connection was forcibly closed by the remote host
body: <p>I am getting the following error when trying to open my Postgresql database from a C# utility:  </p>
  
  <blockquote>
    <p>System.IO.IOException: Unable to read data from the transport
    connection: An existing connection was forcibly closed by the remote
    host. ---> System.Net.Sockets.SocketException: An existing connection
    was forcibly closed by the remote host</p>
  </blockquote>
  
  <p>I have tried running this program from a remote computer and from the computer on which the Postgresql server is running.</p>
  
  <p>There are no firewalls on either computer at this moment and I am able to connect to the database and server just fine through the postgres admin utility using the same password.  I have checked that the username has permissions to the database.</p>
  
  <p>Here is my code for the connection: </p>
  
  <pre><code>public bool updateFromServer()
  {
      try
      {
          NpgsqlConnection conn = new NpgsqlConnection(connString);
          conn.Open();
          conn.Close();
          return true;
      }
      catch (Exception e)
      {
          conn.close()
          return false;
      }
  }
  </code></pre>
  
  <p>Any help with this would be appreciated.</p>