我在应用程序中使用postgreSQL,但有时它会在一段固定的时间间隔后抛出NpgsqlException。
下面是异常的堆栈跟踪:
Exception message: Failed to establish a connection to 'server'.
at EntitySpaces.Interfaces.esDataProvider.esLoadDataTable(esDataRequest request, esProviderSignature sig)
at EntitySpaces.Interfaces.esDynamicQuery.Load()
at BusinessObjects.Users.ValidatePassword(String UserName, String Password) in e:\Code\Entities\Custom\Users.cs:line 50
at PassiveSTS.Login.Login_Authenticate(Object sender, AuthenticateEventArgs e) in e:\Code\STS\Login.aspx.cs:line 32
at System.Web.UI.WebControls.Login.AttemptLogin()
at System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Failed to establish a connection to 'server'.
at Npgsql.NpgsqlClosedState.Open(NpgsqlConnector context) in C:\Npgsql\NpgsqlClosedState.cs:line 171如果有人知道我做错了什么,请帮助我。
提前谢谢。
发布于 2015-05-21 19:50:10
转到以下文件夹: Program Files\PostgreSQL\9.4\data
打开文件'pg_hba.conf‘并在下面的部分中添加行,
IPv4本地连接:托管所有100.10.1.00/24 md5
其中,100.10.1.00是您访问postgres服务器的服务器ip。
否则,您可以添加以下行:
托管所有0.0.0.0/0 md5
允许所有ips连接。重新启动服务器并尝试。
将以下行添加到'postgresql.conf‘文件中
listen_address = '*‘端口= 5432
https://stackoverflow.com/questions/19422016
复制相似问题