无法连接在heroku上运行的postgres数据库

时间:2014-03-31 05:29:59

标签: c# postgresql heroku

我想在myoku上运行我的postgres数据库上的数据表。我可以查看我的表throw view.php,它包含在同一台服务器中。但是当我尝试连接pg数据库时抛出c#,它给了我error.i认识到主机出错是我的IP地址。 谷歌搜索后我发现我需要编辑hba.pba file.i已经安装了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:
在google搜索之后我发现我需要编辑hba.pba文件。我已经安装了psql(shell)终端并且我尝试命令SHOW hba_file。但是它说必须是超级用户来检查&#34; hba_file&# 34;有人可以帮助我解决我的问题

1 个答案:

答案 0 :(得分:2)

关键点在于:

  

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安装,你无法完全控制(但作为交换,你不必管理它)。