I am developing ASP.NET MVC application that interacts with PervasiveDB, running on separate external database server. I use Pervasive ADO.NET Data Provider with connection string like: ServerDSN=dbname;UID=user;PWD=password;ServerName=87.xxx.xx.xxx;
On my development machine everything is fine while debugging with IIS express, but when i deploy my app on remote hosting server that runs IIS 7.0 i am getting exception, when trying connect db.
Code:
PsqlConnection conn = new PsqlConnection(ConnectionString);
conn.Open();
try
{
PsqlCommand cmd = new PsqlCommand(query);
cmd.Connection = conn;
PsqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
...
}
}
finally
{
conn.Close();
}
Exception:
2013-01-28 15:40:21.2574|ERROR|App.WebApiApplication|Pervasive.Data.SqlClient.PsqlException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 87.xxx.xx.xxx:1583 at Pervasive.Data.SqlClient.PsqlConnection.Open()
at App.DBFacade.TestConnection()
at App.WebApiApplication.Application_Start()
Ping from hosting server to database server is OK.
I don't realize what's the difference between my development enviroment and production one, and how can i fix this error.
The cause of this error was that hosting provider blocked connection on given ip and port.