473,385 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ThreadAbortException when using Trace

Hey guys,

I just got some really weird behavior. I put the following code into the
Application_Start event in Global.asax:

// init some trace listeners
Uri codeBase = new Uri(Assembly.GetExecutingAssembly().CodeBase);
string fileName = Path.GetDirectoryName(codeBase.LocalPath);
fileName = Path.Combine(fileName, "pmatsiemens_trace" +
DateTime.Now.ToString("yyyyMMddHHmmss") + ".log");
TextWriterTraceListener listener = new TextWriterTraceListener(fileName,
"FileLogger");
Trace.Listeners.Add(listener);
Trace.AutoFlush = true;
Trace.WriteLine("Application started");

When I then run a web application I notice that Application_Start is
executed over and over again. In the output window I see the following error
messages:

Application started
'/LM/W3SVC/1/Root/MyWebApp-34-127730118577453952': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temp orary asp.net
files\mywebapp\2e53becd\66ad82af\qf3dspm5.dll', Symbols loaded.
aspnet_wp!library!af4!10/5/2005-10:51:05:: i INFO: Cleaned 0 batch records,
0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running
jobs
Application ended
An unhandled exception of type 'System.Threading.ThreadAbortException'
occurred in Unknown Module.
Additional information: Thread was being aborted.
The program '[2760] aspnet_wp.exe:
/LM/W3SVC/1/Root/MyWebApp-34-127730118577453952' has exited with code 0
(0x0).
The thread '<No Name>' (0x62c) has exited with code 0 (0x0).

Does anybody have a clue why this is happening?

Thanks, Christoph
Nov 19 '05 #1
4 1785
Christopher,

This is only a guess, but normally in .NET when you change the web.config
file and re-save or change a .dll file and re-save the application restarts
to get the new code. Whatever listner triggers the application restart might
be triggered by your code that is writing to the application's directory.
Try saving elswhere. I think that will resolve the issue.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Christoph Wienands" <ch****************@siemens.remove.com> wrote in
message news:un*************@tk2msftngp13.phx.gbl...
Hey guys,

I just got some really weird behavior. I put the following code into the
Application_Start event in Global.asax:

// init some trace listeners
Uri codeBase = new Uri(Assembly.GetExecutingAssembly().CodeBase);
string fileName = Path.GetDirectoryName(codeBase.LocalPath);
fileName = Path.Combine(fileName, "pmatsiemens_trace" +
DateTime.Now.ToString("yyyyMMddHHmmss") + ".log");
TextWriterTraceListener listener = new TextWriterTraceListener(fileName,
"FileLogger");
Trace.Listeners.Add(listener);
Trace.AutoFlush = true;
Trace.WriteLine("Application started");

When I then run a web application I notice that Application_Start is
executed over and over again. In the output window I see the following
error messages:

Application started
'/LM/W3SVC/1/Root/MyWebApp-34-127730118577453952': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temp orary asp.net
files\mywebapp\2e53becd\66ad82af\qf3dspm5.dll', Symbols loaded.
aspnet_wp!library!af4!10/5/2005-10:51:05:: i INFO: Cleaned 0 batch
records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0
running jobs
Application ended
An unhandled exception of type 'System.Threading.ThreadAbortException'
occurred in Unknown Module.
Additional information: Thread was being aborted.
The program '[2760] aspnet_wp.exe:
/LM/W3SVC/1/Root/MyWebApp-34-127730118577453952' has exited with code 0
(0x0).
The thread '<No Name>' (0x62c) has exited with code 0 (0x0).

Does anybody have a clue why this is happening?

Thanks, Christoph

Nov 19 '05 #2
The ThreadAbortException is a bit of a trick ASP.NET uses when a Response.Redirect
is used.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hey guys,

I just got some really weird behavior. I put the following code into
the Application_Start event in Global.asax:

// init some trace listeners
Uri codeBase = new Uri(Assembly.GetExecutingAssembly().CodeBase);
string fileName = Path.GetDirectoryName(codeBase.LocalPath);
fileName = Path.Combine(fileName, "pmatsiemens_trace" +
DateTime.Now.ToString("yyyyMMddHHmmss") + ".log");
TextWriterTraceListener listener = new
TextWriterTraceListener(fileName,
"FileLogger");
Trace.Listeners.Add(listener);
Trace.AutoFlush = true;
Trace.WriteLine("Application started");
When I then run a web application I notice that Application_Start is
executed over and over again. In the output window I see the following
error messages:

Application started
'/LM/W3SVC/1/Root/MyWebApp-34-127730118577453952': Loaded
'c:\windows\microsoft.net\framework\v1.1.4322\temp orary asp.net
files\mywebapp\2e53becd\66ad82af\qf3dspm5.dll', Symbols loaded.
aspnet_wp!library!af4!10/5/2005-10:51:05:: i INFO: Cleaned 0 batch
records,
0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0
running
jobs
Application ended
An unhandled exception of type 'System.Threading.ThreadAbortException'
occurred in Unknown Module.
Additional information: Thread was being aborted.
The program '[2760] aspnet_wp.exe:
/LM/W3SVC/1/Root/MyWebApp-34-127730118577453952' has exited with code
0
(0x0).
The thread '<No Name>' (0x62c) has exited with code 0 (0x0).
Does anybody have a clue why this is happening?

Thanks, Christoph

Nov 19 '05 #3
> This is only a guess, but normally in .NET when you change the web.config
file and re-save or change a .dll file and re-save the application
restarts to get the new code. Whatever listner triggers the application
restart might be triggered by your code that is writing to the
application's directory. Try saving elswhere. I think that will resolve
the issue.


Goood catch! Should have thought of that myself. Whenever a file changes in
the bin directory the app seems to restart. Now I just save it to a log
directory.

Thanks, Christoph
Nov 19 '05 #4
Christoph,

Lucky guess... YW :-)

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Christoph Wienands" <ch****************@siemens.remove.com> wrote in
message news:Ok**************@TK2MSFTNGP12.phx.gbl...
This is only a guess, but normally in .NET when you change the web.config
file and re-save or change a .dll file and re-save the application
restarts to get the new code. Whatever listner triggers the application
restart might be triggered by your code that is writing to the
application's directory. Try saving elswhere. I think that will resolve
the issue.


Goood catch! Should have thought of that myself. Whenever a file changes
in the bin directory the app seems to restart. Now I just save it to a log
directory.

Thanks, Christoph

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mark Phillips | last post by:
Hello, I am having a problem in which a file can get stuck open when a thread that is attempting to write to it gets aborted (ThreadAbortedException occurs). The log file gets stuck open until...
6
by: David Waz... | last post by:
Moved an app from W/2000 Asp V1.0 to W/2003, VS/2003, ASPV 1.1 Page runs a long job, uploading 2 large fixed length files (300,000 rows) into SQL database. A process is run against the data,...
0
by: Chee | last post by:
Hi all Please forgive me if this has been asked before. I am getting a ThreadAbortException in "Unknown Module" when i try to load a page from VS.NET. One problem is it does not happen all the...
4
by: splap20 | last post by:
Every day a large chunk of XML is posted up to my app via http. The app interprets this XML and writes results to a SQLServer. Occasionally a ThreadAbortException is thrown during this process....
1
by: Eric | last post by:
I have the following situation: I was getting intermittent errors using Reponse.Redirct("url", true) and was trying to catch the ThreadAbortException, but it was not staying caught and was showing...
6
by: foolmelon | last post by:
If a childThread is in the middle of a catch block and handling an exception caught, the main thread calls childThread.Abort(). At that time a ThreadAbortException is thrown in the childThread. ...
3
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
Hi, I am running a web service which sometimes throws exceptions. I have a lot of error trapping within the web service, but I have missed the current problem. I am working on the current issue,...
0
by: Zeba | last post by:
Hi ! I am using a httphandler to perform some url rewriting in my application. My web.config contains the following entry to direct all urls containing /App/*.ashx to my class AppHandler.cs in...
0
by: Morgan Cheng | last post by:
It is recommended that to re-throw Exception in catch block with just "throw;" instead of "throw ex;", because "throw ex;" lose the original Exception's stack trace. ThreadAbortException will be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.