问题
I 'm trying to connect postgresql database remotely ( Heroku ). I use ASP Web api but always i have the same exception :Message "28000: no pg_hba.conf entry for host \"xx.xxx.xxx.xxxx\", user \"User", database \"databasename\", SSL off" I search some solution by editing the pg_hba.conf file and i add : host databasename username xx.xxx.xxx.xxxx md5 and no change .
回答1:
Add sslmode=Require; and Trust Server Certificate=true; in your connection string.It will work for sure.
回答2:
Heroku Postgres requires client connections are made with SSL. Configure your application to require SSL on database connections and this error will go away.
回答3:
host all all 0.0.0.0/0 trust
or host all all 192.168.0.0/24 trust
of course, you also need
listen_address = '*'
来源:https://stackoverflow.com/questions/44161509/message28000-no-pg-hba-conf-entry-for-host-xx-xxx-xxx-xxxx-user-user