473,387 Members | 1,502 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,387 software developers and data experts.

Force service failure

Per microsoft, the ExitCode property of the ServiceBase returns 0 for
success and non zero for failure. However, when I set this property to
1, the service still stops in a success state.

Protected Overrides Sub OnStart(ByVal args() As String)
End Sub

Protected Overrides Sub OnStop()
End Sub

Private Sub Document_Exception(ByVal sender As Object, ByVal e As
ExceptionEventArgs)
' Exit unsuccessfully and force service rules to run
Me.ExitCode = 1
Me.Stop()
End Sub

This code executes the OnStop method and shows the ExitCode to be 1,
but it says "Service stopped successfully." in the event viewer and it
won't fire any failure options.

Jun 14 '06 #1
0 1035

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

Similar topics

3
by: nek | last post by:
Greetings, I'm using DB2 WSE V8.1 FP2 on W2K SP4. Right clicking 'properties' from 'DB2 - DB2' service (Admin Tools -> Services), then selecting 'recovery' tab allows me to select computer's...
0
by: HJ | last post by:
The Windows platform provides a mechanism to automatically restart a service when a failure occurs in the 'Recovery' tab in the services panel. It allows you to specify actions on first, second...
2
by: Strahimir Antoljak | last post by:
I am creating a new windows service and I would like to control its Recovery property. On a system administrator level the Recovery property is found in Control Panel -> Administrative Tools ->...
2
by: David Hunt | last post by:
I'm developing a Windows Service and just added a standard try... catch exception handler to its OnStart() routine. I would like to know how to force the service to abort its startup when an...
3
by: Paul | last post by:
Hi all. Can someone provide some help on the following as there seems to be many different methods of acheiving the same outcome. Basically I am trying to develop a web service which will...
3
by: Shailesh Humbad | last post by:
I figured out what was causing the "Access is Denied" error when calling functions from referenced DLLs in my service. I've tried to be very detailed, so bear with me. It turns out that...
1
by: yancheng.cheok | last post by:
Hi all, According to "How can I handle a constructor that fails?" in http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.2, whenever there is a constructor fail, we will throw...
4
by: Jianwei Sun | last post by:
Hi, all, I have a question, and I hope to get some hints here.. I created a really simple service just to check why the service manager doesn't start my service the second time if the first...
1
by: svandanapu | last post by:
Hi All, I written one windows service and its working fine. I Need to check the recovery settings of that service from one windows application. How do I can get the recovery settings of(first...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.