[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Thread was being aborted

Posted on 2012-12-26
4
Medium Priority
?
492 Views
Last Modified: 2013-01-01
I am running a process from my asp.net application in a separate thread.
This process takes time as it has to insert 150000 records in the table.

But I am getting "Thread was being aborted" error some where around 6000 th  record only.

What can I do here to keep the running till all records gets imported.
0
Comment
Question by:yadavdep
[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
  • 2
4 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38722790
Did you make the thread a background thread?

e.g.

Thread t = new Thread(SomeFunction);

t.IsBackground = true;

Open in new window

0
 

Author Comment

by:yadavdep
ID: 38722795
No, I don't think I did that.

Also, I recheck the code and I guess it is running in the main thread only.

If it is running in the main thread then is there any solution to it
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38722803
I suppose that depends on how you want to solve it. If you want to run it on the main thread, then your user's browser window is going to sit there spinning until the operation completes--assuming it completes before your configured timeout period. Otherwise, I *think* you would need to make the thread a background thread in order to allow ASP.NET to return a response to the client browser, yet still continue processing the DB inserts. This foregos returning a response to the browser in that request. You would have to work some AJAX magic in order to see a response from the background thread's work.
0
 
LVL 8

Accepted Solution

by:
Volox earned 840 total points
ID: 38725639
I believe there is a timeout setting in the IIS configuration either for the site or for the app pol that might be able to be extended in order to let your thread complete.  Best practice would be to put the work into a worker thread but the timeout setting might give you a quick fix.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

650 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