Samples SERVICES

This forum is for eXpress++ general support.
Post Reply
Message
Author
skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Samples SERVICES

#1 Post by skiman »

Hi,

I tried the sample SERVICES, but I don't succeed.

This is what I did.
In service_install.prg I hardcoded cUser and cpass. For cUser I added the .\, so cuser is '.\chris'.
I start the following: service_install i -> this installs SERVICE.EXE, it comes into the services list in task manager. Is is marked as stopped.
Then I start: service_install s -> this should start the service, but nothing happens.
If I right-click in the taskmanager on my service, I have the option to start the service manually. When I try this i get the message 'Cannot start the service' and 'access denied'.
When I execute: service_install u -> this uninstall the service. This takes some time, but after about 15 seconds, the service disappears from the list in taskmanager.

I checked the documentation and looked at the source code. There is the following:

Code: Select all

oCtrl        := ServiceController()
  oCtrl:addController( cServiceName ,                       ;
                       "eXpress++ Services Sample"   , ;
                        cLocation + cServiceName + ".exe" , ;
                       cUser, cPass,  /*parameter*/ , ;
                       oLog )
Below there is as in the xbase++ documentation:

Code: Select all

  DO CASE
  CASE cFlag == "i"
    ServiceController():install( cServiceName )
  CASE cFlag == "s"
    ServiceController():start( cServiceName )
  CASE cFlag == "x"
    ServiceController():stop( cServiceName )
  CASE cFlag == "u"
    ServiceController():uninstall( cServiceName )
  OTHERWISE
    Usage()
    Quit
  ENDCASE
I was wondering if this is correct. I tried with the following modification:

Code: Select all

  DO CASE
  CASE cFlag == "i"
    oCtrl:install( cServiceName )
  CASE cFlag == "s"
    oCtrl:start( cServiceName )
  CASE cFlag == "x"
    oCtrl:stop( cServiceName )
  CASE cFlag == "u"
    oCtrl:uninstall( cServiceName )
  OTHERWISE
    Usage()
    Quit
  ENDCASE
The above results remains the same.

What am I doing wrong?
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Samples SERVICES

#2 Post by skiman »

Hi,

In the xbase++ samples for the simpleservice, I found the readme. Now I can install, start, stop and uninstall the service.
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Samples SERVICES

#3 Post by skiman »

Hi,

I replaced the SERVICES.EXE with my application COUNT.EXE and now it doesn't work anymore. I can install it as a service, but I can't start it. I did the same within the administrative tools as described in the readme as mentioned in the previous post, but it doesn't work.

Before we had it running without local user, without problem to use it as service, but printing wasn't working. Starting as local user it isn't working.

Any suggestions?
Best regards,

Chris.
www.aboservice.be

Post Reply