Hi guys,
I have a windows service which runs few timers to perform a certain task,
my code is well wrapped with "Try...Catch"s, but still whenever an error
occurs and an exception is being thrown, it executes the code in the "Catch"
section and instead of continue, the service stops.
What gives?
I want it to continue running even if an exception was cought.
Thanks!
Ori :) 5 1203
Depend on what code you have in the Catch block.
chanmm
"Ori :)" <Or*@discussions.microsoft.com> wrote in message
news:BA**********************************@microsof t.com... Hi guys,
I have a windows service which runs few timers to perform a certain task, my code is well wrapped with "Try...Catch"s, but still whenever an error occurs and an exception is being thrown, it executes the code in the "Catch" section and instead of continue, the service stops.
What gives?
I want it to continue running even if an exception was cought.
Thanks!
Ori :)
This is a frustrating aspect of structured error
handling. Once an error is caught, it won't go back into
the code.
You can do what I have done and go back to using on error
statements:
Sub Demonstration ()
On Error GoTo Demonstration_Error
Code Statements....
Exit Sub
Demonstration_Error:
Code to handle the error....
Resume Next
End Sub
It may not be structured, but it is a lot more flexible
and it allows you to carry on.
HTH
Helen -----Original Message----- Hi guys,
I have a windows service which runs few timers to perform
a certain task,my code is well wrapped with "Try...Catch"s, but still
whenever an erroroccurs and an exception is being thrown, it executes the
code in the "Catch"section and instead of continue, the service stops.
What gives?
I want it to continue running even if an exception was
cought. Thanks!
Ori :) .
Just a call to a "WriteExMessageToFile" sub. which completes with no problem
"chanmmn" wrote: Depend on what code you have in the Catch block.
chanmm
"Ori :)" <Or*@discussions.microsoft.com> wrote in message news:BA**********************************@microsof t.com... Hi guys,
I have a windows service which runs few timers to perform a certain task, my code is well wrapped with "Try...Catch"s, but still whenever an error occurs and an exception is being thrown, it executes the code in the "Catch" section and instead of continue, the service stops.
What gives?
I want it to continue running even if an exception was cought.
Thanks!
Ori :)
Thanks! will try.
Any idea why is it different than a winform application in which it does not
end the program?
"Helen Trim" wrote: This is a frustrating aspect of structured error handling. Once an error is caught, it won't go back into the code.
You can do what I have done and go back to using on error statements:
Sub Demonstration () On Error GoTo Demonstration_Error
Code Statements....
Exit Sub Demonstration_Error:
Code to handle the error.... Resume Next End Sub
It may not be structured, but it is a lot more flexible and it allows you to carry on.
HTH Helen
-----Original Message----- Hi guys,
I have a windows service which runs few timers to perform a certain task,my code is well wrapped with "Try...Catch"s, but still whenever an erroroccurs and an exception is being thrown, it executes the code in the "Catch"section and instead of continue, the service stops.
What gives?
I want it to continue running even if an exception was cought. Thanks!
Ori :) .
"Ori :)" <Or*@discussions.microsoft.com> wrote in message
news:BA**********************************@microsof t.com... I have a windows service which runs few timers to perform a certain task, my code is well wrapped with "Try...Catch"s, but still whenever an error occurs and an exception is being thrown, it executes the code in the "Catch" section and instead of continue, the service stops.
/Where/ is the Catch block?
Since you're using Timers, are you /always/ re-enabling them, /even if/
you catch an Exception?
HTH,
Phill W. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: MatthewRoberts |
last post by:
Howdy All,
I have a Windows Service that often stops in its tracks with no
exception and no explanation on our QA system.
During testing on the development machine, it can handle any workload,...
|
by: Martijn Remmen |
last post by:
I have developed a service which exposes a COM object. This service is
running perfect on Windows 2000 Server and Windows 2000 Professional
under the SYSTEM account.
When the service is...
|
by: belgiozen |
last post by:
Hi,
I have a working windows service,it is looking for files on the disk
and when some of the files are cupdated it calls an executable. But it
takes a lot of time(about 10 minutes) to run the...
|
by: Mike |
last post by:
I want to create a windows service that will monitor another window service.
what i need for the service to do is, if a service is stopped I need it to
start the service back up
example:
...
|
by: Nathan Kovac |
last post by:
I have a windows service project created with a timer that fires an event
over and over. I created an installer & the service appears to install
correctly. When I try to start the service I get a...
|
by: Chris Dunaway |
last post by:
I am attempting to use the AppDomain.UnhandledException event in a
Windows Forms app and also in a Windows Service. But the event doesn't
seem to be called.
In a Windows Forms app, the event IS...
|
by: Sergey Krutous |
last post by:
Can you please help me to resolve the following issue:
I developed a windows service. At start up (I have overriden OnStart
method) it connects to a web service and if the connection fails the...
|
by: jajalc |
last post by:
Hi all,
WE have a windows service using .net and which uses a
System.Timers.Timer..all the of code works fine..... but after a
extended period of time the timer just stops firing the elasped...
|
by: pbd22 |
last post by:
Hi.
I know my windows service works when i run it in debug mode on my dev
machine.
It also works in release mode on my dev machine. But, when I move the
service to
a production server, it...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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...
|
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
|
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...
|
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...
|
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,...
|
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,...
| |