473,396 Members | 2,004 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,396 software developers and data experts.

How to resolve an exception in windows service( .net framework 2.0)

i use try..catch in my windows service,and when some exception occurs,
i write it to event logs.
in webapplication ,if you use a catch to "hold" an exception, and do
not throw up, the exception will be ignore if it is available.

my windows service is a mul-thread service, which workes for a growing
work-list. but some workitems of this list will make erros when
services is running for it.

the question is:
when exception occurs, the service is terminated. how can i let the
service continue running without any termination?

Jul 16 '07 #1
2 1675

<zh*****@gmail.comwrote in message
news:11**********************@d30g2000prg.googlegr oups.com...
>i use try..catch in my windows service,and when some exception occurs,
i write it to event logs.
in webapplication ,if you use a catch to "hold" an exception, and do
not throw up, the exception will be ignore if it is available.

my windows service is a mul-thread service, which workes for a growing
work-list. but some workitems of this list will make erros when
services is running for it.

the question is:
when exception occurs, the service is terminated. how can i let the
service continue running without any termination?
You could try a set the Exception to Null. I have done that when an
Exception has occlude in a try/catch to clear the Exception so that it
wouldn't bubble up causing another method that called it to terminate above
it.

Jul 16 '07 #2
In .NET 2.0 an unhandled exception on any thread will bring down the whole
appdomain and therefore your managed executable. the solution would be to
handle the exception before it bubbles to the top of the call stack and then
let the thread terminate gracefully. there is no special case with Windows
Services, if you handle an exception, it will not propagate (except in the
casse of ThreadAbortException)

A question worth asking is if you are really benefitting from running a
growing list of tasks concurrently? If so, have you considered using the
ThreadPool to mitigate some of the issues of running unbounded numbers of
threads?

"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>
<zh*****@gmail.comwrote in message
news:11**********************@d30g2000prg.googlegr oups.com...
>>i use try..catch in my windows service,and when some exception occurs,
i write it to event logs.
in webapplication ,if you use a catch to "hold" an exception, and do
not throw up, the exception will be ignore if it is available.

my windows service is a mul-thread service, which workes for a growing
work-list. but some workitems of this list will make erros when
services is running for it.

the question is:
when exception occurs, the service is terminated. how can i let the
service continue running without any termination?

You could try a set the Exception to Null. I have done that when an
Exception has occlude in a try/catch to clear the Exception so that it
wouldn't bubble up causing another method that called it to terminate
above it.
Jul 17 '07 #3

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

Similar topics

8
by: Fabio Papa | last post by:
I am trying to write a windows service that sends emails to clients at specific times based on information in a sql db. Since this is done for multiple cities, I start a thread for each city and...
8
by: Jan Gregor | last post by:
Hello I run python script on another computer and want to "survive" that script after my logout. the script also uses drive mapping to network drive. Can you help me ? Or better is there some...
8
by: Bf | last post by:
I was creating test projects using c# and was surprised that there seems to be only a form based windows applications available. Is it safe to assume that classic window applications that utilize a...
2
by: dan | last post by:
hi ng. i have a asp.net application which is client of an asp.net webservice. now i want to configure a custom error page (in case the sewrvice throws an exception) that provides the...
3
by: Harry Hudini | last post by:
How on earth are you meant to debug a service in .net ? Clearly it wont let me debug the service from the IDE, but running the service as a service on a machine severely limits what you can do....
2
by: Tom Simpson | last post by:
I have set up a Windows service in VB.NET, and created a 'Service Manager' Windows Forms app that can 'get' information from that service. The service consists of the basic service 'framework'...
2
by: Angelos Karantzalis | last post by:
Hi y'all, we're using a bunch of classes in a project, that we wanted to convert to-from xml easily. So, we defined XmlAttribute annotations for our class members and all worked fine. The Xml...
0
by: thefinitemonkey | last post by:
When using wsdl.exe to try and create a framework class, I get an error "Error: URI formats are not supported" I've tried specifying the location to load the file as both local and URL paths. I...
0
by: Martin Bühlmann | last post by:
Hi, I'm writing a Windows Service framework using .NET Framework 2.0. Communication between Service and Service-Console ("Tray-Icon") is done using remoting. All the base functionality for the...
5
by: Tim Zottberg | last post by:
Hello! I thought that the last post was closed, but then Tom wrote something interesting. Sorry I didn't post in the old subject... The Windows Framework is meant to enabled XP styles,...
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:
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.