我在这个简单的代码中有线程被中止异常,当我运行长查询时在IIS 6上运行。
线程正在中止。
栈跟踪:
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, CommandBehavior 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
源代码:
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;
}
}