473,778 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Service takes 1 min 34 sec to start

Sam
Service properties
------------------
Log On As: LocalSystem
Logon account has full admin privileges.
OnStart() routine
-----------------
{
EventLog->WriteEntry ("Commencing... "); .... A
Spawn1()
Spawn2()
EventLog->WriteEntry ("Completing... "); .... B
}

In Automatic mode
-----------------
Service takes 1 min 34 sec to start (Time from A to B as recorded in
the Event Viewer). Service Controller Manager complains @ 1 min 30 sec
that "The xxxxx service hung on starting", but the service does start
up eventually and all is well.

In Manual startup mode
----------------------
Service starts in 4 seconds
Details
-------
Spawn1() starts a managed remoting server
Spawn2() starts a process inside a real time kernel (RTX). The kernel
itself starts "on demand", and is a manual service. I've listed this
kernel as a dependency for my service.

Question
--------
1. How do I debug this and reduce the time in Automatic Startup mode?
2. Why doesnt the SCM throw an exception even though my service
violates the 30 second OnStart rule?

Thank you.
Sam

Nov 16 '05 #1
4 2493
I'm assuming it complains at start up of the machine, I've not done much
with services in .net, but is it possible you need to add the Eventlog
service as a dependent of yours since you are writing to the event log in
your start up? This may cause your service to wait it's starting till the
eventlog is fully started.

--
Thanks
Wayne Sepega
Jacksonville, Fl
"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

"Sam" <sp*****@yahoo. com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Service properties
------------------
Log On As: LocalSystem
Logon account has full admin privileges.
OnStart() routine
-----------------
{
EventLog->WriteEntry ("Commencing... "); .... A
Spawn1()
Spawn2()
EventLog->WriteEntry ("Completing... "); .... B
}

In Automatic mode
-----------------
Service takes 1 min 34 sec to start (Time from A to B as recorded in
the Event Viewer). Service Controller Manager complains @ 1 min 30 sec
that "The xxxxx service hung on starting", but the service does start
up eventually and all is well.

In Manual startup mode
----------------------
Service starts in 4 seconds
Details
-------
Spawn1() starts a managed remoting server
Spawn2() starts a process inside a real time kernel (RTX). The kernel
itself starts "on demand", and is a manual service. I've listed this
kernel as a dependency for my service.

Question
--------
1. How do I debug this and reduce the time in Automatic Startup mode?
2. Why doesnt the SCM throw an exception even though my service
violates the 30 second OnStart rule?

Thank you.
Sam

Nov 16 '05 #2
Anything that takes more than 30 seconds should be done on a separate
thread. So what you sould do is spawn a new thread and execute Spawn1 and
Spawn2 on that thread.

Willy.
"Sam" <sp*****@yahoo. com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Service properties
------------------
Log On As: LocalSystem
Logon account has full admin privileges.
OnStart() routine
-----------------
{
EventLog->WriteEntry ("Commencing... "); .... A
Spawn1()
Spawn2()
EventLog->WriteEntry ("Completing... "); .... B
}

In Automatic mode
-----------------
Service takes 1 min 34 sec to start (Time from A to B as recorded in
the Event Viewer). Service Controller Manager complains @ 1 min 30 sec
that "The xxxxx service hung on starting", but the service does start
up eventually and all is well.

In Manual startup mode
----------------------
Service starts in 4 seconds
Details
-------
Spawn1() starts a managed remoting server
Spawn2() starts a process inside a real time kernel (RTX). The kernel
itself starts "on demand", and is a manual service. I've listed this
kernel as a dependency for my service.

Question
--------
1. How do I debug this and reduce the time in Automatic Startup mode?
2. Why doesnt the SCM throw an exception even though my service
violates the 30 second OnStart rule?

Thank you.
Sam

Nov 16 '05 #3
Sam wrote:
Question
--------
1. How do I debug this and reduce the time in Automatic Startup mode?
2. Why doesnt the SCM throw an exception even though my service
violates the 30 second OnStart rule?
When you say "Automatic" you are saying after a reboot ?

So, you are probably waiting for the machine to reboot all of its internal
systems so that you can run the processes in "Spawn()".

What I do is put the processes I want to run in a Timer_Tick method and set
an interval, like, say 120000 ms. So the first time the process runs is
120000ms after start, and then every 120000 ms afterwards ( if thats what
you want ).

Thank you.
Sam


--
Texeme
http://texeme.com

Nov 16 '05 #4
Sam,

You should not execute code in the main service thread. You should instead
spawn a thread that does the initialization. I think that the OnStart method
from ServiceBase should be non-blocking.

TT

"Sam" wrote:
Service properties
------------------
Log On As: LocalSystem
Logon account has full admin privileges.
OnStart() routine
-----------------
{
EventLog->WriteEntry ("Commencing... "); .... A
Spawn1()
Spawn2()
EventLog->WriteEntry ("Completing... "); .... B
}

In Automatic mode
-----------------
Service takes 1 min 34 sec to start (Time from A to B as recorded in
the Event Viewer). Service Controller Manager complains @ 1 min 30 sec
that "The xxxxx service hung on starting", but the service does start
up eventually and all is well.

In Manual startup mode
----------------------
Service starts in 4 seconds
Details
-------
Spawn1() starts a managed remoting server
Spawn2() starts a process inside a real time kernel (RTX). The kernel
itself starts "on demand", and is a manual service. I've listed this
kernel as a dependency for my service.

Question
--------
1. How do I debug this and reduce the time in Automatic Startup mode?
2. Why doesnt the SCM throw an exception even though my service
violates the 30 second OnStart rule?

Thank you.
Sam

Nov 16 '05 #5

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

Similar topics

15
478
by: Jacob Crossley | last post by:
Hello all. We have about 10 Window's services that we wrote in c#. We use them to process row's that we have queued up in various SQL tables. The services seem to hang at least once in any given 24 hour period. Once we reset the service, it goes about its processing business until the next time it hangs. We are wondering if the hanging problem is due to a load issue (too many windows services on a single machine), a code flaw, or an...
5
14125
by: Richard Steele | last post by:
I have created a WinForm application that needs to be run as a windows service (the PC is inaccesible by any user) i have successfully installed the application as a windows service. When i start the service, i get the following error Error 1053: The service did not respond to the start or control request in a timely fashion 1. Is there anyway to extend the timeout period.? I use timed threads to load a serial device driver and this...
5
4933
by: Steve Long | last post by:
Hello, I hope this question isn't too fundamental. I have a feeling it is. I'm trying to start a winform app from a windows service written in C#. I created a class and used it from a windowsforms application and all was well. But when I try to use the class in the OnStart method of a windows service, the process I'm trying to start runs but the window never shows up. Like I said, this may be fundamentally impossible/illogical to do but...
1
527
by: Shane | last post by:
I have a particular requirement when I call a web service; I have to call the web service, wait until the web service returns or my timeout expires (whichever is sooner) and exit. I tried to use the MSDN example to poll a web service and abort it after a specified timeout. Have a look at the code below: /* Set the timeout in seconds*/
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...
11
2321
by: sunil | last post by:
Dear All, I have created a .Net service in 2.0 and running it on a machine that has a Quad Processor. It is failing with the following error. "Error 1053: The service did not respond to the start or control request in a timely fashion" This is what I saw in event Viewer. Timeout (30000 milliseconds) waiting for the MyService Server service to connect.
12
3718
by: Anil Gupte | last post by:
I wrote my Windows Service first as a regular Windows Exe because it is easier to debug. In that I used AppDir = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\")) ' Where this application Excutable sits Now, when I am converting it to a Service, what path can I use? Or can I specify a path in the service to always use as a data path? I would prefer the former because I do not know the layout of...
2
5570
by: =?Utf-8?B?SmltIE93ZW4=?= | last post by:
Hi John, Hopefully this post will find its way back to you - or perhaps be answered by someone else. As I mentioned in my last post on the earlier portion of this thread, changing the serialization settings for the build handled the initial slows we encountered when invoking the web service. Since that time, we ported the original VB.net code over to C# - this was done to make it cleaner easier to include the project in the rest of...
2
731
by: ayush patel | last post by:
Hi I have a service which has to be send an email every tuesday and friday. what i did is i created a timer control like this Timer _timer = new Timer(); while initializing.............. _timer = new Timer(89000000); in start event ............... _timer.Start(); now i call a class in start function and this class takes todays date, checks if it is tuesday or friday and does what ever it has to do.
0
9629
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
9465
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9923
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
8954
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
7474
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
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
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
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2863
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.