npgsql trouble in c# app - An existing connection was forcibly closed by the remote host npgsql trouble in c# app - An existing connection was forcibly closed by the remote host postgresql postgresql

npgsql trouble in c# app - An existing connection was forcibly closed by the remote host


I had spent 1 hour searching same and found no issues. But then realized that PG puts its logs in pg_log folder. I looked in it to see possible issue.

It turn out you just need to have correct "host" entry in "pg_hba.conf" file. For me this file is in C:\Program Files\PostgreSQL\9.1\data directory.For example

host all all 192.168.1.2/32 md5

Where 192.168.1.2 - is your client's ip address.

BTW, you still need to have 5432 port open as Inboud rule (windows Vista, Windows 7, Windows 2008+).