Page 1 of 1

Samples SERVICES

Posted: Tue Dec 08, 2015 5:53 am
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?

Re: Samples SERVICES

Posted: Tue Dec 08, 2015 6:37 am
by skiman
Hi,

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

Re: Samples SERVICES

Posted: Tue Dec 08, 2015 7:36 am
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?