Thread was being aborted exception with Web Service/SQL Server

Hi

We have a C# web service which calls SPs (via the ADO.NET SqlCommand and SqlDataAdapter objects) to read data from a SQL Sever 2000 database.  We get the following exception intermittently

Thread was being aborted.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)    
at System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)    
at System.Data.Common.DbDataAdapter.Fill(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)    
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)     at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)  

Our connection and command timeouts are set to 30 seconds.

If anyone can help, I'd greatly appreciate an explanation or (even better) a workaround

TIA
Wile_E
LVL 4
wile_e_coyoteAsked:
Who is Participating?
 
wile_e_coyoteAuthor Commented:
Turns out that the httpRuntime executionTimeout setting in the machine.config file on the web server was causing IIS to kill the thread after 90 seconds.   Increasing this setting resolved the problem

I'm going to request that this question be closed.
0
 
frodomanCommented:
Check your maximum concurrent connections on SQL Server.  Possibly this is intermittent because you're exceeding the max connections specified - your thread will wait for a free connection and then timeout if one isn't freed up.

0
 
mondayblueboyCommented:
Do you have exception handler in the code? If yes, I suspect the error comes from a line in the try block. Post code might be helpful.

0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
wile_e_coyoteAuthor Commented:
Frodoman - I'm looking into your suggestion.

MondayBlueBoy - Here is (more or less) the code.   But take a look at the stack trace from above.  The error is occuring in the Fill method of the dataadapter.

DataSet ds = new DataSet();
SqlConnection cn = new SqlConnection (...);
SqlDataAdapter da = new SqlDataAdapter ();
da.SelectCommand = mySelectCmd;     //mySelectCmd is on the web service designer and is an SP call

try
{
  da.Fill (ds);
}
catch (Exception e)
...



0
 
mondayblueboyCommented:
Just one more q.
Is that all code in the try block?
0
 
wile_e_coyoteAuthor Commented:
Yes
0
 
wile_e_coyoteAuthor Commented:
Frodoman - our DBA says we are set up to allow unlimited connections
0
 
frodomanCommented:
Possible user interaction during the time your fill is being executed?  Normally the "Thread being aborted" message occurs on a webform during a response.redirect / response.end type of execution (both of which always throw a ThreadAbortException).

I may be completely off base here, but if it's an intermittent problem is it possible that a user is clicking something during the fill that is causing the page to try to reload / change before the dataset is full?
0
 
wile_e_coyoteAuthor Commented:
Naw - the error is reported by the web service (on the SqlDataAdapter.Fill call), not the UI (which is a windows forms app).
0
 
frodomanCommented:
Sorry wile_e - Nothing else I can think of, but good luck solving it!
0
 
wile_e_coyoteAuthor Commented:
Its worth an additional 250 points for me to make some progress on this.   Any takers?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.