I have been struggling with this for a several days. The code runs and connects to the database successfully on my development machine, but when I deploy it to the server, I get this error. I am using Oracle.ManagedDataAccess. This is what I have tried so far.
Checked whether 32bit or 64bit. Turned out to be 64bit
Checked TNS Names file. It was correct
Checked both machines are on the same network. They were.
Tried creating a stripped down console application that connects to the database. The console application worked on both machines. Main application fails to work on server.
Tried creating a stripped down web forms application that connects to the dtabase. The web forms application reproduced the error, ruling out a problem with main application itself.
Tried doubling timeout value.
Tried decreasing timeout value to 1 second.
Tried turning off connection pooling.
Tried increasing connection pool size.
Tried giving IIS_IUSR full privileges over the Oracle Home directory.
Tried rebooting server.
Tried <setting name="SQLNET.AUTHENTICATION_SERVICES" value="null" />
.
Here's the code for the small web application.
string sql = @"
SELECT *
FROM SIMMS_TAB
";
context.Response.ContentType = "text/plain";
int rows = 0;
try
{
using (OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = sql;
var reader = cmd.ExecuteReader();
while (reader.Read())
{
rows++;
}
}
context.Response.Write(string.Format("Successfully connected! Found {0} rows.<br />", rows));
}
catch (Exception ex)
{
context.Response.Write(ex);
}
The exception text is as follows
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): Connection request timed out
at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, CriteriaCtx criteriaCtx, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, CriteriaCtx criteriaCtx, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword, CriteriaCtx criteriaCtx)
at Oracle.ManagedDataAccess.Client.OracleConnection.Open()
at StripedDownWebApplication.TestHandler.ProcessRequest(HttpContext context) in C:\Users\mikem\Source\Repos\StripedDownWebApplication\TestHandler.ashx.cs:line 34