【问题标题】:failed to connect postgres database running on heroku无法连接在 heroku 上运行的 postgres 数据库
【发布时间】:2014-03-31 13:37:13
【问题描述】:

我想查看在 heroku 上运行的 postgres 数据库上的数据表。我可以查看包含在同一服务器上的表 throw view.php。但是当我尝试连接 pg 数据库 throw c# 时,它给了我错误。我认识到主机错误是我的 IP 地址。 谷歌搜索后,我发现我需要编辑 hba.pba 文件。我已经安装了 psql(shell) 终端,我尝试命令 SHOW hba_file 。但据说必须是超级用户才能检查“hba_file”有人可以帮我解决我的问题

Npgsql.NpgsqlException was unhandled
  HResult=-2147467259
  Message=FATAL: 28000: no pg_hba.conf entry for host "61.642.163.26", user "fharmfggzvbzn", database "df4a8lse4537sb", SSL off
  Source=Npgsql
  ErrorCode=-2147467259
  BaseMessage=no pg_hba.conf entry for host "61.642.163.26", user "fharmfggzvbzn", database "df4a8lse4537sb", SSL off
  Code=28000
  ColumnName=""
  ConstraintName=""
  DataTypeName=""
  Detail=""
  ErrorSql=""
  File=auth.c
  Hint=""
  Line=486
  Position=""
  Routine=ClientAuthentication
  SchemaName=""
  Severity=FATAL
  TableName=""
  Where=""
  StackTrace:
       at Npgsql.NpgsqlState.<ProcessBackendResponses_Ver_3>d__9.MoveNext()
       at Npgsql.NpgsqlState.ProcessAndDiscardBackendResponses(NpgsqlConnector context)
       at Npgsql.NpgsqlConnectedState.Startup(NpgsqlConnector context, NpgsqlConnectionStringBuilder settings)
       at Npgsql.NpgsqlConnector.Open()
       at Npgsql.NpgsqlConnectorPool.GetPooledConnector(NpgsqlConnection Connection)
       at Npgsql.NpgsqlConnectorPool.RequestPooledConnectorInternal(NpgsqlConnection Connection)
       at Npgsql.NpgsqlConnectorPool.RequestConnector(NpgsqlConnection Connection)
       at Npgsql.NpgsqlConnection.Open()
       at WindowsFormsApplication1.Form1.button1_Click(Object sender, EventArgs e) in c:\Users\Madhawa\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs:line 57
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at WindowsFormsApplication1.Program.Main() in c:\Users\Madhawa\AppData\Local\Temporary Projects\WindowsFormsApplication1\Program.cs:line 19
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

谷歌搜索后,我发现我需要编辑 hba.pba 文件。我已经安装了 psql(shell) 终端,我尝试命令 SHOW hba_file 。但据说必须是超级用户才能检查“hba_file”有人可以帮我解决我的问题吗?问题

【问题讨论】:

    标签: c# postgresql heroku


    【解决方案1】:

    关键点是:

    Message=FATAL: 28000: no pg_hba.conf entry for host "61.642.163.26", user "fharmfggzvbzn", database "df4a8lse4537sb", SSL 关闭

    您必须请求 SSL 连接。 Heroku 不允许非 SSL 连接。见the nPgSQL documentation for how to request an SSL connection

    您不能在 Heroku 上编辑 pg_hba.conf,这是一个托管的 PostgreSQL 安装,您无法完全控制(但作为交换,您不必管理它)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-21
      • 2021-07-10
      • 1970-01-01
      • 2017-02-24
      • 2023-03-23
      相关资源
      最近更新 更多