473,797 Members | 2,926 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 1864
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******** ********@TK2MSF TNGP03.phx.gbl. ..
>I have a service that will periodically send email messages to system
adminstrator s. 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******** ********@TK2MSF TNGP03.phx.gbl. ..
>I have a service that will periodically send email messages to system
adminstrator s. 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
8152
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 http://tinyurl.com/5s7kx) but that doesn't help. I changed the dependency from MSSQLSERVER to SQLSERVERAGENT which made no difference. I log exceptions to the eventlog which tell me the following error, abridged: Login failed for user 'xxxxxx'. at...
15
2146
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 Process code starts here**************/ System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents=false;
3
2199
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 issue is simply getting timers to work. I have a DatabaseManager.DataManagerFacade which contains a timer. Every 6 seconds it updates stock data using an online webservice. I wrote have 2 possible startup projects to make the service work. One...
3
8009
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 libraries I made myself were not having this problem, but it only happened with a zip library I downloaded and copied into my program's directory. When using classes from this library, my service threw an "Access Is Denied" FileLoadException, which...
2
2460
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 (System.Timers.Timer) which has an interval of 24 hours. Actually, it reads a time like 2AM out of the config file, and calculates the time between the start of the service to 2AM, and sets the timer. When the timer expires, it re-reads the...
8
1195
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 it as a service and then provide another program that displays information on what's going on", or, "should i simply write it as a multi-threaded asynchronous socket beast GUI"?! I like the second option (mainly because it will involve less...
5
1243
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 sends the email for each record and updates the status as 1. The problem is that my service fails when the record size is about 20000-25000. Any one can suggest me a method so that i can send 20000-25000 with in
0
1607
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 the following code to send the emails
5
3597
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 email address works just fine, but I can't get the email sent to two different addresses no matter what I try. Below is my code. If someone could help me spot my errors, I'd appreciate it. Thanks! Code from actual page: <?php //Check if the form...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10468
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...
0
10245
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10205
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,...
0
9063
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7559
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
5458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4131
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
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.