473,770 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Controlled Failure Of a Windows Service

I need to make my service fail so that I can utilise the recovery settings in
the service config screen.

The recovery settings should let me either restart the service, run a
program or restart the computer, however, my VB.Net services have never
failed!

Is there a way I can programatically make them fail?

Thanks.

--
welcome to the mooon !
Feb 15 '06 #1
2 1358
m00nm0nkey wrote:
I need to make my service fail so that I can utilise the recovery settings in
the service config screen.

The recovery settings should let me either restart the service, run a
program or restart the computer, however, my VB.Net services have never
failed!

Is there a way I can programatically make them fail?

Thanks.


Run the Stop() method.
Feb 15 '06 #2
What, like this?

Private Sub tmrScheduler_El apsed(ByVal sender As System.Object, ByVal e As
System.Timers.E lapsedEventArgs ) Handles tmrScheduler.El apsed

If gblnSomethingBa dIsHappening Then

OnStop()

Else

tmrScheduler.St op()
tmrScheduler.En abled = False

SchedulerTimerR espond()

tmrScheduler.En abled = True
tmrScheduler.St art()

End If

End Sub

??
--
welcome to the mooon !
"John Bailo" wrote:
m00nm0nkey wrote:
I need to make my service fail so that I can utilise the recovery settings in
the service config screen.

The recovery settings should let me either restart the service, run a
program or restart the computer, however, my VB.Net services have never
failed!

Is there a way I can programatically make them fail?

Thanks.


Run the Stop() method.

Feb 15 '06 #3

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

Similar topics

10
3154
by: x2164 | last post by:
hi all, Linux 2.4.28 Glibc 2.2.5 gcc 2.95.3 I'm new to Python. I've compiled Python 2.4 from tar file.
1
5468
by: Mack | last post by:
I have written a Windows Service, and while it was working fine previously, it will not start now! Everytime I try to start it, I get a message which reads: "..service was started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service." I dont understand why it is not working now, nothing was changed! Any ideas?
1
366
by: amirmira | last post by:
I have developed a service that monitors the CPU utilization performance counter and updates a table in a database. During the Service Start up, I attempt to connect to the database. I would like to report a Start up failure to the SCM (Service Control Manager) during Service Start up if the connection to the database fails. Also, if the connection fails, I would like the service to stop. How would I achieve this? I am coding in VB.Net.
2
4645
by: robboll | last post by:
On a Windows 2000 Server in MYDomain I can do the following successfully: Net Send JoeUser "test" However on a Windows Server 2003 (Standard Edition) in MyDomain I get: An error occurred while sending a message to JoeUser. The message alias could not be found on the network.
0
1864
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?
1
3962
by: techfuzz | last post by:
I'm posting my problem experience and solution I found here for other ASP.NET developers. I have a web application that uses Forms Authentication with Active Directory to control access. In this web application, I have search page that utilizes the Windows Indexing Service (MSIDXS provider). For reasons I'm not aware of at this time, setting <identity impersonation="true" /> in the web.config causes an error whenever you try to search.
14
1621
by: Bernie Yaeger | last post by:
OK - I'm very close. I'm running a console app on a server and it fails with cdo .message failure. It's a simple email routine which works fine on my development pc. Do you have any idea what would cause this? Thanks for any help. Bernie Yaeger
0
3029
by: Hernan Garber | last post by:
Hi, Attached, the installation log. Win 2k Server SP3 IE6SP1/SQL Server Installed Thanks Setup.exe: Setup.exe: ========== Logging started ==========
0
767
by: jkehayias | last post by:
I have a windows service I created that works perfectly in debug, but as soon as I put it out and install it as a service from release, it gets 2 ticks through the timer and then nothing. Here is some information on it: The service collects statistics information from performance counters on a number of machines and stores it in a SQL database. There is a timer in the base service that on tick ( 5 second intervals) calls an update method...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
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...
1
10002
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,...
1
7415
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
6676
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
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
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
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
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.