[英]Cannot connect webapp to postgresql
我正在嘗試將我的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文件的內容是:#類型數據庫用戶地址方法
# "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
最后幾行是我自己在絕望中添加的。
我沒辦法嘗試了。 誰能建議可能是什么原因造成的?
謝謝。
我設法解決了。 我必須刪除“ ident”條目,而不僅僅是添加md5條目。
一旦我注釋了兩個ident條目,它就開始工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.