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

windows service questions

ZQ
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate threads
than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be invoked
after all pending events are finished?

thanks!

Z.
Feb 8 '06 #1
4 2126
Services and MSMQ (which is also a service) have nothing to do with each
other, unless you tell them to. Every service runs in its own process. The
Starting and Stopping of services is not a concern of MSMQ. MSMQ is a
messenger. It queues messages, and delivers them when it can. If a service
stops, and then starts later, the message will still be there.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:uG**************@TK2MSFTNGP14.phx.gbl...
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate
threads than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be invoked
after all pending events are finished?

thanks!

Z.

Feb 8 '06 #2
ZQ
Ok. Thanx for your quick response.
However.

In my win. service, I have configured it to asynchronously fire up an event
every time a message arrives into a message queue. Once it fires, I
endreceive the
message (and deserialize it), and process the received object. The
processing
takes awhile, and my real question is - if an administrator stops the
service while
the service is processing the message, will it kill the thread in which it
processes the message?

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
Services and MSMQ (which is also a service) have nothing to do with each
other, unless you tell them to. Every service runs in its own process. The
Starting and Stopping of services is not a concern of MSMQ. MSMQ is a
messenger. It queues messages, and delivers them when it can. If a service
stops, and then starts later, the message will still be there.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:uG**************@TK2MSFTNGP14.phx.gbl...
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate
threads than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be invoked
after all pending events are finished?

thanks!

Z.


Feb 9 '06 #3
> if an administrator stops the service while
the service is processing the message, will it kill the thread in which it
processes the message?
Not necessarily. The Stop event sends a message to the service application
to stop. It doesn't kill the thread. That's why there's an event handler
there. But make sure that you account for the Stop event, and don't take too
long to finish up. Then you'll be just fine.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP12.phx.gbl... Ok. Thanx for your quick response.
However.

In my win. service, I have configured it to asynchronously fire up an
event
every time a message arrives into a message queue. Once it fires, I
endreceive the
message (and deserialize it), and process the received object. The
processing
takes awhile, and my real question is - if an administrator stops the
service while
the service is processing the message, will it kill the thread in which it
processes the message?

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
Services and MSMQ (which is also a service) have nothing to do with each
other, unless you tell them to. Every service runs in its own process.
The Starting and Stopping of services is not a concern of MSMQ. MSMQ is a
messenger. It queues messages, and delivers them when it can. If a
service stops, and then starts later, the message will still be there.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:uG**************@TK2MSFTNGP14.phx.gbl...
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate
threads than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be
invoked after all pending events are finished?

thanks!

Z.



Feb 9 '06 #4
ZQ

That's the info I needed.
Thanks, Kevin
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:On**************@TK2MSFTNGP09.phx.gbl...
if an administrator stops the service while
the service is processing the message, will it kill the thread in which
it processes the message?


Not necessarily. The Stop event sends a message to the service application
to stop. It doesn't kill the thread. That's why there's an event handler
there. But make sure that you account for the Stop event, and don't take
too long to finish up. Then you'll be just fine.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP12.phx.gbl...
Ok. Thanx for your quick response.
However.

In my win. service, I have configured it to asynchronously fire up an
event
every time a message arrives into a message queue. Once it fires, I
endreceive the
message (and deserialize it), and process the received object. The
processing
takes awhile, and my real question is - if an administrator stops the
service while
the service is processing the message, will it kill the thread in which
it processes the message?

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
Services and MSMQ (which is also a service) have nothing to do with each
other, unless you tell them to. Every service runs in its own process.
The Starting and Stopping of services is not a concern of MSMQ. MSMQ is
a messenger. It queues messages, and delivers them when it can. If a
service stops, and then starts later, the message will still be there.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:uG**************@TK2MSFTNGP14.phx.gbl...
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate
threads than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be
invoked after all pending events are finished?

thanks!

Z.



Feb 10 '06 #5

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

Similar topics

4
by: Bill Sonia | last post by:
I'm written a Windows Service to send e-mails on events like OnStart, OnStop, OnShutDown using System.Web.Mail. It works for everything but OnShutdown. My guess is that once my send mail code is...
4
by: Kris | last post by:
I have a Windows Service in C# talking to a serial port and using Remoting. It also uses several COM objects. On customer's computer the service will occassionally hang somewhere - the service...
7
by: Gene | last post by:
I have a Windows Service (VB.NET) that runs 24/7. It queries a Web service 5 to 10 times per hour. About 2 or 3 times a month, it fails. The log indicates that it sends the request to the Web...
4
by: Water Cooler v2 | last post by:
I want to run a service at the background but also provide some user interface for editing some configuration options. In this regard, my questions are: 1. Can a Windows Service have a UI along...
2
by: shapper | last post by:
Hello, I usually develop Asp.Net 2.0 (With VB.NET or C#) web sites with SQL 2005 databases. A few of my web sites use online CMS with AJAX. I need to create a Windows Vista compatible...
6
by: Chris Marsh | last post by:
All I have a database table, changes to the data within which I am interested in acting on. The approach that I'm taking is to have the database update a file every time data is updated. This...
41
by: pbd22 | last post by:
Hi. I know my windows service works when i run it in debug mode on my dev machine. It also works in release mode on my dev machine. But, when I move the service to a production server, it...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
0
by: cosmo | last post by:
Hello, I would like to develop a: - Windows Service for doing specific Tasks - Web Service as a communication gateway between the Windows Service and a ASP.NET Website - ASP.NET Website The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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
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,...

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.