开发者

Thread was being aborted In WebService and ASPX page

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜