Note that there are some explanatory texts on larger screens.

plurals
  1. POError 1053 the service did not respond to the start or control request
    primarykey
    data
    text
    <p>I've written a Windows Service in C# that basically checks my db every minute for orders, generates a PDF from these orders, and emails it.</p> <p>The logic works perfectly in my tests etc..</p> <p>When i create the service, and install it using the setup project, when I go to start the service in the services mmc, I get:</p> <blockquote> <p>error 1053 the service did not respond to the start or control request in a timely fashion</p> </blockquote> <p>My OnStart method looks like this:</p> <pre><code>protected override void OnStart(string[] args) { //writeToWindowsEventLog("Service started", EventLogEntryType.Information); timer.Enabled = true; } </code></pre> <p>Basically, just enables the timer... so theres no process intensive call there.</p> <p>Where am I going wrong?</p> <p>I've tried setting the startup account to local system, network service etc... nothing works!</p> <p>Edit:</p> <p>Here is my code: (processPurchaseOrders is the method where the db is queried and pdf's are generated etc...)</p> <pre><code>public partial class PurchaseOrderDispatcher : ServiceBase { //this is the main timer of the service private System.Timers.Timer timer; public PurchaseOrderDispatcher() { InitializeComponent(); } // The main entry point for the process static void Main() { #if (!DEBUG) ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new PurchaseOrderDispatcher() }; ServiceBase.Run(ServicesToRun); #else //debug code PurchaseOrderDispatcher service = new PurchaseOrderDispatcher(); service.processPurchaseOrders(); #endif } private void InitializeComponent() { this.CanPauseAndContinue = true; this.ServiceName = "Crocus_PurchaseOrderGenerator"; } private void InitTimer() { timer = new System.Timers.Timer(); //wire up the timer event timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); //set timer interval var timeInSeconds = Convert.ToInt32(ConfigurationManager.AppSettings["TimerIntervalInSeconds"]); timer.Interval = (timeInSeconds * 1000); // timer.Interval is in milliseconds, so times above by 1000 timer.Enabled = true; } protected override void Dispose(bool disposing) { if (disposing &amp;&amp; (components != null)) components.Dispose(); base.Dispose(disposing); } protected override void OnStart(string[] args) { //instantiate timer Thread t = new Thread(new ThreadStart(this.InitTimer)); t.Start(); } protected override void OnStop() { //turn off the timer. timer.Enabled = false; } protected override void OnPause() { timer.Enabled = false; base.OnPause(); } protected override void OnContinue() { timer.Enabled = true; base.OnContinue(); } protected void timer_Elapsed(object sender, ElapsedEventArgs e) { processPurchaseOrders(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload