I'm having the Thread was being aborted exception in this simple code, running on IIS 6 when I run a long query.
Thread was being aborted.
StackTrace:
at Oracle.DataAccess.Client.OpsSql.ExecuteReader(IntPtr opsConCtx, IntPtr& opsErrCtx, IntPtr& opsSqlCtx, IntPtr& opsDacCtx, IntPtr& opsReaderErrCtx, IntPtr opsSubscrCtx, Int32& isSubscrRegistered, Int32 bchgNTFNExcludeRowidInfo, Int32 bQueryBasedNTFNRegistration, Int64& query_id, OpoSqlValCtx*& pOpoSqlValCtx, String pCommandText, OpoDacValCtx*& pOpoDacValCtx, IntPtr[] pOpoPrmValCtx, String[] ppOpoPrmRefCtx, OpoMetValCtx*& pOpoMetValCtx, Int32 NoOfParams) at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBe开发者_如何学Gohavior behavior) at Oracle.DataAccess.Client.OracleCommand.ExecuteReader() at TestWeb._Default.runQuery() in C:\Users\xfx1874\Documents\Visual Studio 2008\Projects\TestWeb\TestWeb\Default.aspx.cs:line 65
Source code:
protected void launchButton_Click(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(runQuery));
exTime.Text = "launching...";
t.Start();
}
private void runQuery()
{
bool hasRows;
log("Start - " + DateTime.Now);
try
{
using (OracleConnection oracleConnection = new OracleConnection(OracleConnectionString))
{
oracleConnection.Open();
using (OracleCommand oracleCommand = new OracleCommand())
{
oracleCommand.Connection = oracleConnection;
oracleCommand.CommandTimeout = ORACLE_TIMEOUT;
oracleCommand.CommandText = query;
using (OracleDataReader oracleReader = oracleCommand.ExecuteReader())
{
hasRows = oracleReader.HasRows;
}
}
}
log("End - " + DateTime.Now);
}
catch (Exception ex)
{
log(DateTime.Now + " - Exception message: " + ex.Message + " \n StackTrace: " + ex.StackTrace);
throw;
}
}
Have you tried setting your executionTimeout http://msdn.microsoft.com/en-us/library/e1f13641.aspx
精彩评论