473,796 Members | 2,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1692

<zh*****@gmail. comwrote in message
news:11******** **************@ d30g2000prg.goo glegroups.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 ThreadAbortExce ption)

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.c omwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>
<zh*****@gmail. comwrote in message
news:11******** **************@ d30g2000prg.goo glegroups.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
2032
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 continue the processing from each thread. My service starts fine (gives me no errors, etc), but it doesn't seem to start the new threads. I am new to windows services, so I don't know if I'm doing something wrong. Should I maybe be doing this...
8
3241
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 info for unix person how to survive with python on windows ;-) thanks, jan gregor
8
1658
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 parent window with child windows can only be done in c++ and mfc and there's nothing else in .net that is meant to be used like that? It seems to be that c# should be used for either form based windows apps, console apps, and web apps (also...
2
2411
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 soapexception detail property as text. but when defined in web.config, the error page doesn't provide access to the thrown exception anymore. i think that i somehow have to enter the http pipeline to catch the error, read the data and transfer to a error...
3
1103
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. debuggin by using the event log is impossible. Any ideas on how to best approach this ? Olly --
2
1817
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' along with a large class that I wrote that actually does all the work. The Service Manager app uses .NET remoting to get info into/back from the service. I have a couple of questions that I need info on before I complete this service:
2
2486
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 stream came from an external source with a custom xml schema, so we had no alternative. However, along the way we came to the point that we must expose those classes as return types for a web service. Returning an instance of a class through the...
0
1051
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 even tried placing my wsdl file in the folder with wsdl.exe and loading it from there. In all cases I get the same error. Any help figuring this out would be much appreciated. Thanks, Doug
0
314
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 service is written in a dll, so if one has to implement a real service, he can create a new Windows Service project and use this dll. Now I ran into a problem with the remoting implementation on the service (server side). I implemented a method...
5
1119
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, correct? If I want to start with a sub main then I cannot have XP styles, correct? So what is the usual workaround?
0
9679
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10453
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.