473,396 Members | 2,052 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,396 software developers and data experts.

Returning error during service startup

(x-posted to microsoft.public.dotnet.general and
microsoft.public.dotnet.languages.vb)

Hello all.

I am currently creating a Windows Service using VB.NET and would like to
return an error if something goes wrong during startup, IE: parsing a
configuration file.

The only way I know of is to throw an exception, and this will prevent the
service from starting. However it will not display an error message. Using
this method, I get the following:

Could not start the <service name> on Local Computer.
The service did not return an error. This could be an internal
Windows error or an internal service error.
If the problem persists, contact your system administrator.

The error message leads me to believe it is possible to return an error, but
I have not been able to find any documentation as to how to do this.

Any help would be greatly appreciated,

Thanks,
-matt
Nov 20 '05 #1
8 1816
Instead of raising the error, write a detailed event log entry (which can
include a complete exception and its stack trace for debugging purposes)
using the System.Diagnostic EventLog class. You can then use a Service
Controller to gracefully pause or stop your service.

-Rob Teixeira [MVP]

"matt breedlove" <si*******@gmx.net> wrote in message
news:6n********************@twister.tampabay.rr.co m...
(x-posted to microsoft.public.dotnet.general and
microsoft.public.dotnet.languages.vb)

Hello all.

I am currently creating a Windows Service using VB.NET and would like to
return an error if something goes wrong during startup, IE: parsing a
configuration file.

The only way I know of is to throw an exception, and this will prevent the
service from starting. However it will not display an error message. Using this method, I get the following:

Could not start the <service name> on Local Computer.
The service did not return an error. This could be an internal
Windows error or an internal service error.
If the problem persists, contact your system administrator.

The error message leads me to believe it is possible to return an error, but I have not been able to find any documentation as to how to do this.

Any help would be greatly appreciated,

Thanks,
-matt

Nov 20 '05 #2
Instead of raising the error, write a detailed event log entry (which can
include a complete exception and its stack trace for debugging purposes)
using the System.Diagnostic EventLog class. You can then use a Service
Controller to gracefully pause or stop your service.

-Rob Teixeira [MVP]

"matt breedlove" <si*******@gmx.net> wrote in message
news:6n********************@twister.tampabay.rr.co m...
(x-posted to microsoft.public.dotnet.general and
microsoft.public.dotnet.languages.vb)

Hello all.

I am currently creating a Windows Service using VB.NET and would like to
return an error if something goes wrong during startup, IE: parsing a
configuration file.

The only way I know of is to throw an exception, and this will prevent the
service from starting. However it will not display an error message. Using this method, I get the following:

Could not start the <service name> on Local Computer.
The service did not return an error. This could be an internal
Windows error or an internal service error.
If the problem persists, contact your system administrator.

The error message leads me to believe it is possible to return an error, but I have not been able to find any documentation as to how to do this.

Any help would be greatly appreciated,

Thanks,
-matt

Nov 20 '05 #3
I'm currently writing the detailed exception to the event log, I was just
wondering if there was a more appropriate way to stop the service and return
an informational message at that point, rather than no message at all and
require the user to check the event log.

Thanks for the input,
-matt
"Rob Teixeira [MVP]" <RobTeixeira@@msn.com> wrote in message
news:OR**************@TK2MSFTNGP11.phx.gbl...
Instead of raising the error, write a detailed event log entry (which can
include a complete exception and its stack trace for debugging purposes)
using the System.Diagnostic EventLog class. You can then use a Service
Controller to gracefully pause or stop your service.

-Rob Teixeira [MVP]

"matt breedlove" <si*******@gmx.net> wrote in message
news:6n********************@twister.tampabay.rr.co m...
(x-posted to microsoft.public.dotnet.general and
microsoft.public.dotnet.languages.vb)

Hello all.

I am currently creating a Windows Service using VB.NET and would like to
return an error if something goes wrong during startup, IE: parsing a
configuration file.

The only way I know of is to throw an exception, and this will prevent the service from starting. However it will not display an error message.

Using
this method, I get the following:

Could not start the <service name> on Local Computer.
The service did not return an error. This could be an internal
Windows error or an internal service error.
If the problem persists, contact your system administrator.

The error message leads me to believe it is possible to return an error,

but
I have not been able to find any documentation as to how to do this.

Any help would be greatly appreciated,

Thanks,
-matt


Nov 20 '05 #4
I'm currently writing the detailed exception to the event log, I was just
wondering if there was a more appropriate way to stop the service and return
an informational message at that point, rather than no message at all and
require the user to check the event log.

Thanks for the input,
-matt
"Rob Teixeira [MVP]" <RobTeixeira@@msn.com> wrote in message
news:OR**************@TK2MSFTNGP11.phx.gbl...
Instead of raising the error, write a detailed event log entry (which can
include a complete exception and its stack trace for debugging purposes)
using the System.Diagnostic EventLog class. You can then use a Service
Controller to gracefully pause or stop your service.

-Rob Teixeira [MVP]

"matt breedlove" <si*******@gmx.net> wrote in message
news:6n********************@twister.tampabay.rr.co m...
(x-posted to microsoft.public.dotnet.general and
microsoft.public.dotnet.languages.vb)

Hello all.

I am currently creating a Windows Service using VB.NET and would like to
return an error if something goes wrong during startup, IE: parsing a
configuration file.

The only way I know of is to throw an exception, and this will prevent the service from starting. However it will not display an error message.

Using
this method, I get the following:

Could not start the <service name> on Local Computer.
The service did not return an error. This could be an internal
Windows error or an internal service error.
If the problem persists, contact your system administrator.

The error message leads me to believe it is possible to return an error,

but
I have not been able to find any documentation as to how to do this.

Any help would be greatly appreciated,

Thanks,
-matt


Nov 20 '05 #5
Hi Matt,

How did you set up the function call to the webservice and how do you return
the error in that?

(Show us some code maybe we can help you than)

Cor
Nov 20 '05 #6
Hi Matt,

How did you set up the function call to the webservice and how do you return
the error in that?

(Show us some code maybe we can help you than)

Cor
Nov 20 '05 #7
I saw my own read error.

Cor
Nov 20 '05 #8
I saw my own read error.

Cor
Nov 20 '05 #9

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

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
8
by: matt breedlove | last post by:
(x-posted to microsoft.public.dotnet.general and microsoft.public.dotnet.languages.vb) Hello all. I am currently creating a Windows Service using VB.NET and would like to return an error if...
6
by: Ashwin Kambli | last post by:
Hi, I am trying to write a Windows Service application using C#. I wrote a very trivial example (logs messages during Start and Stop events to the evenlog). I have no problem installing it (using...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
8
by: Kevin D. | last post by:
Please note, I already posted this on the MySQL official forum, but received no response. I thought I'd try again in another location. My apologies to anyone reading this twice... Despite...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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,...
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...
0
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...
0
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,...

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.