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

Gracefully fail to start a service

If my service fails to start, I'd like to notify the user and either display
an error or direct them to check the event log to see more info. With
Win32, you could return a non-0 number to the SCM during startup and a
dialog would be displayed (by the SCM) showing the error number and
directing the user to check the error log for further information.

Is there similar functionality in .NET? I've tried throwing exceptions and
calling Environment.Exit([some number]) in OnStart(), but both cause the SCM
to display some useless dialog.

How are you guys handling this?
-Joel
Jul 21 '05 #1
1 1301
Having the service display a message its very tricky, because (typically)
services are started on an different Windows Station than the one hooked up
to the monitor and keyboard. Even if you do put up a message box, you one
will see it (and perhaps worse, no one can respond to it).

Logging an error message and throwing an exception is your best bet. Yes,
the message is not good (it implies that there might *not* be a problem).

Nick.

"Joel Lyons" <NO*********@NOVARAD.NET> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
If my service fails to start, I'd like to notify the user and either display an error or direct them to check the event log to see more info. With
Win32, you could return a non-0 number to the SCM during startup and a
dialog would be displayed (by the SCM) showing the error number and
directing the user to check the error log for further information.

Is there similar functionality in .NET? I've tried throwing exceptions and
calling Environment.Exit([some number]) in OnStart(), but both cause the SCM to display some useless dialog.

How are you guys handling this?
-Joel

Jul 21 '05 #2

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

Similar topics

1
by: Kaushik | last post by:
I am installing MSDE 2000 redistributable as a part of my setup program using Visual Studio Setup & Deployment Project. But I need to start the mssqlserver service manually by going into the control...
3
by: Bryan | last post by:
We created a Windows Service with C#. The service will start OK on computers that are a member of a domain, but when we try to start it on a server that is configured for a workgroup we get the...
2
by: Philip Wagenaar | last post by:
I have created a windows service and added a installer for the service. The service is set to autostart. After installation the service is listed in services as autostart. This is all fine, but I...
1
by: Joel Lyons | last post by:
If my service fails to start, I'd like to notify the user and either display an error or direct them to check the event log to see more info. With Win32, you could return a non-0 number to the SCM...
3
by: Robert | last post by:
Hello, I have created a windows service that performs some automatic backups. It works, and it is set to start automatically. However, it is not started directly after the installation...
1
by: scott | last post by:
I create a service project and build into service.exe , intall it as system service. With a service.exe.config file in the directory as service.exe. so that I can not start service. I use vs2005...
14
by: W2K3R2admin | last post by:
I cannot open help and support...how do I install it on an existing system? When I click on Help & Support, the error says "Windows cannot open Help and Support because a system service is not...
1
by: johnmiin | last post by:
Hi, I installed Tomcat 5.5 in windows vista. As soon as I right click "start service" in apache tomcat,it showed attempt to start the following service, but it doesn't stay start,no matter how many...
1
by: ziycon | last post by:
I have a batch file and all it does is stop a service call the deltree file to empty a directory and the start the service but its wont start the service back up. The first two lines run a fine,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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...
0
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...
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.