473,657 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2140
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******** ******@TK2MSFTN GP14.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***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u%******** ********@TK2MSF TNGP09.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******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP12.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***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u%******** ********@TK2MSF TNGP09.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******** ******@TK2MSFTN GP14.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***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:On******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP12.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***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:u%******** ********@TK2MSF TNGP09.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******** ******@TK2MSFTN GP14.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
7122
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 executed, other necessary Windows Services have been terminated before it can actually send the mail. I've updated my HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services registry DependOnService value including SMPTSVC and others. My hope is...
4
9005
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 still shows on a Task Manager list. In Services it says it is still running. However there is no way to stop it other than by rebooting the whole computer. No exception (including non-CLS) is ever generated. I added a separate System.Timers.Timer...
7
10053
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 service but there is no return from the service. Stopping and restarting the Windows service cures the problem. Our desire is to cure the problem with appropriate error handling but failing that, is there an easy way to automatically stop and...
4
1157
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 with it? 2. Can I associate a NotifyIcon (systray icon) with a Web service? 3. Can a Windows service be such that it runs only on a particular Windows account on the domain? I mean can it use Windows Authentication to see if it must start up on a...
2
508
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 application that includes the features I usually have in my CMS: 1. Send a retrieve content from the web site SQL 2005 database.
6
595
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 process is outside my domain - I can rely on the file being updated when data changes. Within my domain is the design of a Windows service to perform the operations required when the data changes. I have not produced a Windows service before...
41
11630
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 exits immediately with a start/stop/nothing to do error. What could be wrong?
5
3296
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? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
0
1876
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 scenario: A user clicks a button on a ASP.NET website to get some forecast. The button invokes a web service method i.e. GetForecast(). Now the web method calls a task method on the Windows Service. Finally the windows service returns a result...
0
8403
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
8833
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...
1
8509
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
8610
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5636
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
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
2735
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
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.