473,503 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Service Question - Sending Email on successful startup.

I have a service that will periodically send email messages to system
adminstrators. I would like for this service to send a email notification
whenever the service is started and when it is stopped. I placed attempted
to do that from the OnStart event procedure... but any messages sent during
the OnStart procedure are not sent. But when the service is stopped, the
email messages from both the OnStart and OnStop event procedure are sent.

How can I send email messages from a service when it starts successfully?
Apparently the OnStart event procedure is not the place to do it. I looked
at the ServiceBase class and didn't see any other events or methods that
would apparently do what I need.

Thanks!
Oct 2 '07 #1
2 1836
Further testing shows that the email messages sent during the OnStart event
procedure are *eventually* sent - after a delay of 1-2 minutes.

-S

"Smithers" <A@B.comwrote in message
news:ON****************@TK2MSFTNGP03.phx.gbl...
>I have a service that will periodically send email messages to system
adminstrators. I would like for this service to send a email notification
whenever the service is started and when it is stopped. I placed attempted
to do that from the OnStart event procedure... but any messages sent during
the OnStart procedure are not sent. But when the service is stopped, the
email messages from both the OnStart and OnStop event procedure are sent.

How can I send email messages from a service when it starts successfully?
Apparently the OnStart event procedure is not the place to do it. I looked
at the ServiceBase class and didn't see any other events or methods that
would apparently do what I need.

Thanks!

Oct 2 '07 #2
"Smithers" <A@B.comwrote in message
news:ON****************@TK2MSFTNGP03.phx.gbl...
>I have a service that will periodically send email messages to system
adminstrators. I would like for this service to send a email notification
whenever the service is started and when it is stopped. I placed attempted
to do that from the OnStart event procedure... but any messages sent during
the OnStart procedure are not sent. But when the service is stopped, the
email messages from both the OnStart and OnStop event procedure are sent.

How can I send email messages from a service when it starts successfully?
Apparently the OnStart event procedure is not the place to do it. I looked
at the ServiceBase class and didn't see any other events or methods that
would apparently do what I need.

Thanks!

The OnStart method should only be used to perform basic service
initialization stuff, when OnStart doesn't return within 30 seconds after
the SCM posted the Start command, the SCM will flag the service as "failed
to start" and kill the service process. So, sending a mail from within
OnStart makes no sense, at this point, the Service didn't yet start and you
have no guarantee it ever will.

Willy.
Oct 3 '07 #3

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

Similar topics

9
8131
by: Alan Pretre | last post by:
I have a Windows service that is having trouble starting up at boot time. It requires SQL Server to start up. I have added MSSQLSERVER to the service dependencies (as explained in...
15
2118
by: Chakkaradeep | last post by:
Hi all, i have written a Service,now i want to execute another application (for eg;calc.exe) in the service....how will i perform it??... i tried using this.... /**************Executing a...
3
2179
by: Nathan Kovac | last post by:
I have a feeling I am missing something simple, but I just can't find it. Perhaps someone can give me a lead on where to look. I will describe the issue then post my code to the web service. My...
3
7972
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...
2
2437
by: Trevor | last post by:
Argh! This problem is driving me nuts! Can you help? In November of 2003, I installed a web service on Windows Server 2003 built in VB.NET for v1.1.4322 of the framework. It contains a timer...
8
1183
by: pigeonrandle | last post by:
Hi, I am writing a server application and would like to know what you experts think i should write it as. I would like (ie need) it to have a visual interface, hence the question, "Should i write...
5
1229
by: neeraj | last post by:
I have made a service which picks up records from a table which has following columns :From,to,subject,body,status The service, after picking up the records, loops through all the records and...
0
1592
by: bankar.sachin | last post by:
Hello All, I am working on an service application to send an emails from exchange server. I want to use the groups created in the exchange server to send the mail. At present I am using...
5
3572
by: wktarin | last post by:
Hi. I'm a relative newcomer to the world of php, and I keep bumping into a problem with a mail () form. I need to send an automatic email to two addresses, but I can't seem to get it to work. One...
0
7198
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
7271
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
7319
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...
1
6979
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
7449
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...
0
5570
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,...
0
4666
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...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
373
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...

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.