postgresql - 主机 "0.0.0.0"、用户 "UserName"、数据库 "orders"、SSL 的 Azure Postgres : no pg_hba. conf 条目

标签 postgresql azure azure-web-app-service npgsql

我正在开发一个 Azure 网站,该网站连接到新的 Azure Postgresql 数据库。

此错误似乎是从周末开始的。周五我上次尝试时效果很好。我的 Azure 站点计划的 IP 地址似乎发生了变化,我编辑了 Azure Postgres 防火墙规则。

真正奇怪的部分是“0.0.0.0”主机。对于数据库来说,Web 服务器的 IP 地址如何看起来像“0.0.0.0”?我也将“0.0.0.0”添加到防火墙中,但这没有任何效果。我当然无法直接在 Azure 上编辑 pg_hba.conf 文件。

此外,从我的开发计算机运行时它工作正常。我尝试重新部署我的网站,但没有成功。

这是完整的堆栈跟踪:

[PostgresException (0x80004005): 28000: no pg_hba.conf entry for host "0.0.0.0", user "UserName", database "orders", SSL on]
Npgsql.NpgsqlConnector.DoReadMessage(DataRowLoadingMode dataRowLoadingMode, Boolean isPrependedMessage) +310
Npgsql.NpgsqlConnector.ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode) +195
Npgsql.NpgsqlConnector.HandleAuthentication(String username, NpgsqlTimeout timeout) +57
Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout) +299
Npgsql.ConnectorPool.Allocate(NpgsqlConnection conn, NpgsqlTimeout timeout) +573
Npgsql.NpgsqlConnection.OpenInternal() +366
Npgsql.NpgsqlConnection.Open() +4
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +120
System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +160
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +108
MapHazardsPro4.Functs.GetUserTable() in C:\inetpub\wwwroot\maphazardspro_q3_2017\Functs.vb:539
MapHazardsPro4.Global.Application_Start(Object sender, EventArgs e) in C:\inetpub\wwwroot\maphazardspro_q3_2017\Global.asax.vb:49

[HttpException (0x80004005): 28000: no pg_hba.conf entry for host "0.0.0.0", user "UserName", database "orders", SSL on]

System.Web.HttpApplicationFactory. EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +10104513
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +173
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): 28000: no pg_hba.conf entry for host "0.0.0.0", user "UserName", database "orders", SSL on]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10085804
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

最佳答案

我也遇到了同样的问题。添加防火墙规则 0.0.0.0 - 255.255.255.255

关于postgresql - 主机 "0.0.0.0"、用户 "UserName"、数据库 "orders"、SSL 的 Azure Postgres : no pg_hba. conf 条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46916828/

相关文章:

sql - 从连接表中获取多个不同的值

postgresql - Heroku PostgreSQL - 如何在没有证书的情况下发生 SSL 连接?

azure - 调用 Azure 资源的 MOVE 时,204 响应意味着什么(而不是 202)

azure - 尽管重试切换,MSDeploy 到 Azure 站点仍频繁失败

azure - 如何在azure web应用程序中捕获请求 header

postgresql - 将 "pg"gem 与 Rails 3 一起使用...为什么我在执行 "bundle install"时会在 Netbeans 中收到此错误?

ruby-on-rails - 使用 postgresql 和 ruby​​ on rails 优化时间序列数据检索的数据库查询

c# - 无法在 Azure 上将 MSI 与 AKS 结合使用

python - 当开发服务器运行时(在 Kudu 上),基于 Django 的 Azure Web App 陷入困境

azure - 如何更新 Azure 中的 Web 应用程序并始终保持应用程序运行