473,395 Members | 1,681 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,395 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 22 '05 #1
8 2772
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 22 '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 22 '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 22 '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 22 '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 22 '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 22 '05 #7
I saw my own read error.

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

Cor
Nov 22 '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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
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...

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.