3

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 procedure 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,

4

The issue was the page was timing out. I had the code working on my development environment, but when I moved it to QA it failed. On my development environment 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>
</location>

Once I did that and retested it worked for me!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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