.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

System.Threading.ThreadAbortException: Thread was being aborted

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :SharePoint

In my ASP.Net web application, one of the function is calling the WCF service that has been developed by .Net framework 3.0 using VS2005.It works fine on production and user can make request 8 times(calls) between client and service after that the web application got hanged and generated the following error message. But it works fine on development even more than 8 requests.

I given the proxy time out 20 min in the client side proxy setting.

Error message:

View Complete Post

More Related Resource Links

System.Threading AND email


Hi guys,

I really need some help (and also some code example), in how to use System.Threading to send emails.

The issue is:

a) I have a function that sends emails;

b) But I don't want to keep the customers waiting for the email being sent;

c) so, I figure it out that the System.Threading is the best way to do that; But I don't know how exactly I cant use it.

PLEASE, i'm VB - not C# - developer, and I really appreciate help in that language.

I can't use Windows Services or SQL Jobs...

Could you help me on this?



asp.net c# DELEGATE THREAD: Multi threading



In my asp.net web application i have lengthy excution process like word merge. I want to merge the word documents and send to client in a procedure. Basically i am looking for run and forget kind of asynchronous process.

In my for loop i tried to create delegate and rstrat. like this

filenames is a string array, creating in the same loop and assiging values before calling delegate.


MailSender mail = new MailSender();



TestDelegate testdele = new

How to prevent thread form being stopped/aborted?

I'm not sure if it's a CLR related issue but at the same time i can't say it isn't. The problem is as follows: I have created a windows forms user control that spawns a thread(running a form). The thread is not a background thread and it's not supposed to exit until the form gets closed. It works as desired when the control is hosted in a windows forms application. The problem starts when i want to host it inside a html page. All works fine as long as the page containing the control is opened. Things get a bit weird when i redirect or close the tab(not the window; more tabs are opened). Exactly 1 minute from this moment the thread gets aborted. public partial class IEControl : UserControl { public IEControl() { InitializeComponent(); } private System.Threading.Thread t; private MainForm mf; private void IEControl_Load(object sender, EventArgs e) { GoThread(); } public void GoThread() { try { t = new System.Threading.Thread(RunForm); t.IsBackground = false; t.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void RunForm() { mf = new MainForm(); Application.Run(mf); GC.KeepAlive(mf); GC.KeepAlive(this); } } I'm a bit confused at this point. Where could I get any information on this topic if it's not a CLR/GC related issue.

System.InvalidOperationException: Instance operation is not valid on workflow runtime thread

Am getting the exception related in the title of this article when using the StateMachineWorkflowInstance object to arbitarily set state in my workflow code; and am unsure why.  The code follows below:   500     Protected Overrides Function Execute(ByVal executionContext As System.Workflow.ComponentModel.ActivityExecutionContext) As System.Workflow.ComponentModel.ActivityExecutionStatus   501    502    506         Dim smwi As StateMachineWorkflowInstance = New StateMachineWorkflowInstance(StaticWFRuntime.LocalRuntime, Me.WorkflowInstanceId)   511    512         'set workflow-wide database connection string   513         _connectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString   518    519         Utility.LogEnabled()   520    521         Utility.FoaeaLogger.WriteEntry("Processing TracingApplication.Execute()....", EventLogEntryType.Information)   522         If StaticWFRuntime.LocalRuntime Is Nothing OrElse StaticWFRuntime.LocalRuntime.IsStarted = False Then   523             Utility.FoaeaLogger.WriteEntry("No static RuntimeService object exists!", EventLogEntryType.Warning)   524         End If   525    526         Return MyBase.Execute(executionContext)   527    528     End Function   796     Private Sub gotoState2_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs)   797    798        

Thread being aborted Error -- while using sqlldr

public sub LoaddataIntotable() _errorLogFilePath = something _badLogFilePath = something _discardLogFilePath = something credentialTokens = "connection string" objCommand.UserName = "scott" objCommand.Password = "tiger" objCommand.Host = "oracle" objCommand.ControlFile = "test.ctl" objCommand.LogFile = _errorLogFilePath objCommand.BadFile = _badLogFilePath objCommand.DataFile = _dataFilePath objCommand.DiscardFile = _discardLogFilePath objCommand.IsParallel = False objCommand.IsDirectLoad = True _objShell.Command = "SQLLDR" _objShell.Arguments = objCommand.ToString AddHandler _objShell.Exited, AddressOf OnProcessExit _objShell.Start() end sub Private Sub OnProcessExit(ByVal sender As Object, ByVal e As CommandLineProcess.ExitedEventArgs) Try If Not e Is Nothing Then If _processExited = False Then _processExited = True CommandCompleted(e.ExitCode) Exit Sub Else ' Event raised again

'System.ExecutionEngineException' occurred in WindowsBase.dll parsing Run in separate thread

Receiving the above exception when attempting to fire off a BackgroundWorker and parse the FlowDocument via Run. Sometimes does not reference WindowsBase...as such Exception of type 'System.ExecutionEngineException' was thrown. Some key things are that if I run the exact same code on the UI thread there are no issues at all. If I run the code as a BackgroundWorker and the document is very small, no issues will surface either...although that may be a timing issue masking itself. Below is the entire parsing class...things begin in the method at the bottom the ParseRuns method.   public class Parser : IParser { private void OnDoWork(object sender, DoWorkEventArgs e) { ParseRuns(e); } private void OnWorkComplete(object sender, RunWorkerCompletedEventArgs e) { ParserHandler handler = _parsingHandler; if (handler != null) handler(this, new ParserArgs((e.Result as List<Data>)[0].Words, (e.Result as List<Data>)[1].Words, e.Error)); } #region IParser Members private ParserHandler _parsingHandler; event ParserHandler IParser.ParsingCompleted { add { _parsingHandler += value; } remove { _parsingHandler -= value; } } void IParser.Parse(FlowDocument origText, FlowDocument modifiedText) { //nothing to do with null if (origText == null || modifiedText == null) return; //ParseUIThread(origText, mo

Blob Cache Event ID 7888 Runtime Exception Thread was being aborted

HI, We have 3WFE and we are getting error Events 788 and 5538 on all three servers at same time. Any thoughts on what is causing this error? Event Type: Error Event Source: Office SharePoint Server Event Category: Office Server General Event ID: 7888 Date:  9/14/2010 Time:  2:31:08 PM User:  N/A Computer: MOSS2007A Description: A runtime exception was detected. Details follow. Message: Thread was being aborted. Techinal Details: System.Threading.ThreadAbortException: Thread was being aborted.    at System.Threading.ReaderWriterLock.AcquireWriterLockInternal(Int32 millisecondsTimeout)    at Microsoft.SharePoint.Publishing.BlobCache.<>c__DisplayClass14.<>c__DisplayClass17.<FetchItemFromWss>b__11()    at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock) For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.   Event Type: Error Event Source: Office SharePoint Server Event Category: Publishing Cache Event ID: 5538 Date:  9/14/2010 Time:  2:31:08 PM User:  N/A Computer: MOSS2007A Description: An error occured in the blob cache.  The ex

SPUtility.TransferToErrorPage(message) System.Thread.Abort


In a web part, i create a new site and add some items to the list of the neew site.

Then i redirect to the site.

If there is any error i use the SPUtility.TransferToErrorPage(message) but there is an error System.Thread.Abort.


I was googling and found that if there is any code running, this error should appears.

Any solution for this problem? any other function?


Is Dispatcher.BeginInvoke really NOT thread safe, while the old System.Windows.Forms.Control.BeginIn




System.Windows.Forms.Control.BeginInvoke is documented as thread safe (in fact, BeginInvoke , EndInvoke , Invoke , InvokeRequired , and CreateGraphics are).



But in WPF, Dispatcher.BeginInvoke is not documented as thread safe. Which would appear to me as a regression (and not really convenient, to be honest).

Was it only forgotten in MSDN documentation, or should I really use external locking to prevent the dispatcher to get lost in its messages and priorities?



Thanks. ;)

How does System.Threading.Timer work (implementation details)


I've read a bunch of articles on the different .NET timers and still don't have a good understanding how the System.Threading.Timer class works.  My concern is whether I'm creating a bunch of timer threads in the thread pool.  I have this concern because one article said something about System.Threading.Timer using a thread pool thread to WAIT on the timer.  I'm hoping that each System.Threading.Timer class I create doesn't create a thread pool timer thread waiting on my timer interval.  I assume not.  Which is why I would like to know how it actually works.

For instance, let's say I create 50 System.Threading.Timer objects with a 5 second interval.  What happens?  Is there some interop call into unmanaged code which creates some timer resources and somehow signals some managed code when a timer has elapsed at which point the managed code queues a work item to the thread pool?  So in my example, at roughly the same point in time .NET would queue 50 work items to the thread pool?



Thread was being aborted



I hit the above error, and below is the stack trace. Any ideas? It doesn't happen regularly.

Thank you

    Stack trace:    at System.Web.Configuration.HttpModuleAction.get_Entry()
   at System.Web.Configuration.HttpModulesSection.CreateModules()
   at System.Web.HttpApplication.InitModules()
   at System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers)
   at System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context)

Where is System.Threading.Parallel?


Where does one find the System.Threading.Parallel library? It is supposedly part of the BCL, according to ECMA 335, but Google only turned up three references to it, with one of them in the standard itself.

For those of you unfamiliar with this library, it is supposed to make parallel computing easier, by providing classes such as ParallelFor, ParallelWhile, and ParallelForEach.

Dynamic controls added at runtime, threading, The calling thread cannot access this object because a




My problem is on load I initialise a new thread. This thread create a new control then tries to add the control to a stackapnel and the error I receive is -

The calling thread cannot access this object because a different thread owns it.

Heres is my code e-




t = new

Threading - how can thread update a variable shared with the Main thread


I'm new to threading and have used it successfully, but limited.  I can spawn a thread and have the main thread reference variables in the spawned thread, but I don't know how to allow the spawned thread to reference (and update) variables in the main thread.

Any example threading code I've seen on the web appears to be WAY more complicated than what I do, so I am unable to understand or integrate into my code.

Here is a quick example of how I use threading:


public partial class ThreadVariableSharing : System.Web.UI.Page


To list all running tasks - System.Threading.Tasks


Hi everyone,

I am working on System.Threading.Tasks namespace. My requirement is to see all the running tasks within a program, their state and interdependencies.

I have looked at the http://msdn.microsoft.com/en-us/library/system.threading.tasks.task.aspx but could not find a way that will list all running tasks. Would you please guide me how to approach and where to look for?



While processing large cubes, various file system errors: "the background thread running lazy writer



We consistently get these I/O errors when processing large OLAP databases.  After a reboot, I can usually get a database to process a few times, but then suddenly reprocessing will fail with errors similar to the one shown below, when nothing changed (no data or structure changes).  The specific file(s) it reports are always different.  Also, sometimes it crashes the msmdsrv.exe process, which seems to intermittently affect other server functions as well (killing the ability to RDP into the server, or the ability to open Event Viewer).


<error message>

File system error: The background thread running lazy writer encountered an I/O error.
Physical file: \\?\D:\OLAPData\SSAS1\SA1.166.db\SA1 Data Source View 1.238.cub\Fact Subject.231.det\Fact Subject.221.prt\271.Aspect.Source Key.fact.map.hdr.
Logical file: .
File system error: The following error occurred while writing to the file 'LazyWriter Stream':
Insufficient system resources exist to complete the requested service. .
File system error: The background thread running lazy writer encountered an I/O error.
Physical file: \\?\D:\OLAPData\SSAS1\SA1.166.db\SA1 Data

WebService Thread was being aborted



i have a windows service that listens to a directory with FileSystemWatcher.

i listen to xml files that are being copied to the directory.

when a xml is copied i call an WS that runs thrue the Xml File and dose what it has to do...

now i have 2 problems that maybe someone can assist:

1.in my PROD Server i get an timeout or Thread was being aborted (Exception message) after 2 minutes exactly!! when on my DEV or TEST Server this is not happening...

2.how can i throw into the directory 2 huge Xml Files without getting timeout from Window service?

it takes about 2 hours working on 1 xml file..



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend