Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Thread was being aborted exception with Web Service/SQL Server

Posted on 2003-11-13
13
Medium Priority
?
3,058 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:wile_e_coyote
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
13 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 9742198
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
 
LVL 5

Expert Comment

by:mondayblueboy
ID: 9746018
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
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9750586
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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 5

Expert Comment

by:mondayblueboy
ID: 9751466
Just one more q.
Is that all code in the try block?
0
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9751470
Yes
0
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9817968
Frodoman - our DBA says we are set up to allow unlimited connections
0
 
LVL 42

Expert Comment

by:frodoman
ID: 9818067
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
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9818192
Naw - the error is reported by the web service (on the SqlDataAdapter.Fill call), not the UI (which is a windows forms app).
0
 
LVL 42

Expert Comment

by:frodoman
ID: 9818313
Sorry wile_e - Nothing else I can think of, but good luck solving it!
0
 
LVL 4

Author Comment

by:wile_e_coyote
ID: 9853437
Its worth an additional 250 points for me to make some progress on this.   Any takers?
0
 
LVL 4

Accepted Solution

by:
wile_e_coyote earned 0 total points
ID: 10236236
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question