2

I am using postgreSQL in my application, But some times it throws NpgsqlException after a fixed interval of time.

Below is the stack trace of the exception :

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

Please help if anyone Knows, What i am doing wrong.

Thanks in Advance.

Chris Travers
  • 25,424
  • 6
  • 65
  • 182
Attri
  • 217
  • 5
  • 14

1 Answers1

2

Go to following folder, Program Files\PostgreSQL\9.4\data

open the file 'pg_hba.conf' and addline in following section,

IPv4 local connections: host all all 100.10.1.00/24 md5

where 100.10.1.00 is the server ip from which you are accessing postgres server.

Otherwise you can Add following line,

host all all 0.0.0.0/0 md5

that allow all ips to connect. Restart server and try.

Add following lines to 'postgresql.conf' file

listen_address = '*' port = 5432

Kailas Mane
  • 1,877
  • 1
  • 15
  • 12