realbasic-nug
[Top] [All Lists]

Windows Service starts then immediately stops

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Windows Service starts then immediately stops
From: James Nierodzik <jnierodzik@gmail.com>
Date: Mon, 17 May 2010 10:41:45 -0500
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
Hello listers, I'm having trouble getting a Windows Service to run 'properly'.  
My goal for this sample project was to create a service that would just post a 
message to system debug every 30 seconds.  My problem is that when I manually 
start my service I get the following message 

"The sampleService service on Local Computer started and then stopped.  Some 
services stop automatically if they are not in use by other services or 
programs"

To create the service I made a new project (RS Studio 2010r2) and selected 
'Empty Service' for the template.  I then added a new class to the Project 
named 'srvcTimer' and set the super to Timer.  Here's all the code…


App.Run()
  
  dim checkTimer as srvcTimer
  checkTimer = new srvcTimer
  
  checkTimer.Period = 30000
  checkTimer.Mode = 2


srvcTimer.Action()

  System.DebugLog("Timer event fired")
  


After building the app I added it as a service using the following command in 
Windows 7 


sc create sampleService binPath= c:\path\to\sampleService.exe type= own


This seemed to create the service properly (it shows up in the Services 
Controller), but when I start it I get the message I listed above.

Does anyone tell me what I am doing wrong? Thanks!
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>