473,657 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Except ion(ByVal sender As Object, ByVal e As
ExceptionEventA rgs)
' 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 1051

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

Similar topics

3
2696
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 response if the service fails. So I choose 'restart the service' for first failure and 'reboot the computer' for second failure. Click 'Apply' and 'OK' to confirm this
0
1848
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 and subsequent failures. My question is this: How does my C# service indicate to windows that it is stopping because of a failure, so I can use the built-in Windows failure mechanism?
2
8934
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 -> Services -> Service Properties (right click on a service) -> Recovery tab -> First failure, Second failure properties. Would anyone know if I can (and how) control First, Second Failure property programmatically instead of going to the...
2
18576
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 exception is encountered. In my current version, the exception handler logs the exception, but then the service continues to run. I'd like it to NOT run after logging the exception. Thanks!
3
1613
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 spawn an exe file to run an import and then return a result back to the web service, this would also need the facility to spawn multiple copies of the application upto a maximum figure..............
3
7994
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 libraries I made myself were not having this problem, but it only happened with a zip library I downloaded and copied into my program's directory. When using classes from this library, my service threw an "Access Is Denied" FileLoadException, which...
1
2801
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 exception. However, how can we make the interface easy to use correctly and hard to use incorrectly? Client may forget/ ignore from having a try...catch block whenever they call the constructor. Is there any way we can prevent this from happen?
4
2901
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 time failed.. I created an atl service through the wizard, and the only thing I do is override the PreMessageLoop()...
1
4504
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 failure, second failure and third failure) a service programatically. can any one please help me in this regard. Thanks in advance Sivakumar V
0
8395
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
8732
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...
0
8605
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...
0
7330
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4155
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
2726
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
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
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.