Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have recently upgraded a custom app to sharepoint 2010. The same code worked fine with sharepoint 2007. The error that is being thrown is "Thread was being aborted". The stack trace is

at SNIReadSync(SNI_Conn* , SNI_Packet** , Int32 ) at SNINativeMethodWrapper.SNIReadSync(SafeHandle pConn, IntPtr& packet, Int32 timeout) at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket() at System.Data.SqlClient.TdsParserStateObject.ReadBuffer() at System.Data.SqlClient.TdsParserStateObject.ReadByte() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Namespace.Data.APXData.MapTransactions() at Namespace.Business.Mapping.MapCancelTransactions()

The code that I'm calling is pretty straight forward. Here it is:

    public static void MapCancelTransactions()
    {
        using (SqlConnection sqlConn = new SqlConnection(ConnectionStrings.conn))
        {
            using (SqlCommand sqlCommand = new SqlCommand("sp_MyProc_CANCEL", sqlConn))
            {
                sqlCommand.CommandTimeout = 1200; 
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlConn.Open();
                sqlCommand.ExecuteNonQuery();
            }
        }
    }

I'm not sure how sharepoint manages the connections, but I suspect something changed from 2007 to 2010. I am connecting to ta SQL Server 2005 database. The application works when the stored proc returns in less than 30 seconds, but when it takes longer, I receive the error. Is there another time out happening? Any help would be greatly appreciated.

Thanks,

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The issue was the page was timing out. I had the code working on my development enviroment, but when I moved it to QA it failed. On my development enviroment I had the following

<compilation batch="false" debug="true">

On QA it was set to

<compilation batch="false" debug="false">

Because debug was set to true, it ignores the timeouts in my development environment.

In order to fix on in QA environment, I added to following to the web.config file

<location path="sites/operations/tools/Pages/MyPage.aspx">
<system.web>
  <httpRuntime executionTimeout="36000" />
</system.web>

Once I did that and retested it worked!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.