【问题标题】:Cannot connect webapp to postgresql无法将 webapp 连接到 postgresql
【发布时间】:2018-03-18 19:14:18
【问题描述】:

我正在尝试将我的 asp.net 核心应用程序发布到 linux (Centos) 机器上。在我解决问题时,这只是一个本地虚拟机。

我已经完成了我认为需要的所有步骤,但是当我尝试运行应用程序时,我收到了错误:

Unhandled Exception: System.AggregateException: One or more errors occurred. (28000: Ident authentication failed for user "postgres") ---> Npgsql.PostgresException: 28000: Ident authentication failed for user "postgres"

对于我的一生,我无法弄清楚发生了什么。由于这只是一个 VM 测试环境,因此我将每个密码(我的用户、root、两个 postgres 密码)都设置为相同的。所以我不太可能把它们混在一起。

我使用的连接字符串是:

"User ID=postgres;Password=password;Host=localhost;Port=5432;Database=cp1;Pooling=true;"

我的 pg_hba.conf 文件的内容是: # TYPE 数据库用户地址方法

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident
host    all             all             127.0.0.1/32            password
local   all             postgres                                peer
host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5

最后几行是我自己无奈添加的。

我要尝试的东西已经不多了。任何人都可以提出可能导致这种情况的原因吗?

谢谢。

【问题讨论】:

    标签: postgresql centos


    【解决方案1】:

    我设法解决了这个问题。我必须删除“ident”条目,而不仅仅是添加 md5 条目。

    我一注释掉这两个 ident 条目,它就开始工作了。

    【讨论】:

      猜你喜欢
      • 2021-04-30
      • 2020-07-06
      • 2012-11-01
      • 2019-11-02
      • 1970-01-01
      • 2020-01-01
      • 2019-09-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多