Page 1 of 1

Can you create a Windows service with Phalanger?

PostPosted: May 14th, 2014, 8:20 am
by Marko
Hello,

I'm trying out Phalanger and so far it looks quite interesting. When I attempted to create a Windows Service I ran into an obstacle that I couldn't overcome.

I created a simple dummy service which I was able to install using sc.exe, however when I try to start it, the service fails with the error 1053: The service did not respond to the start or control request in a timely fashion.

The event log also shows this error:
A timeout was reached (30000 milliseconds) while waiting for the DummyService service to connect.

Here's my code:

Code: Select all
<?php

use System;
use System\ServiceProcess;

class DummyService extends System\ServiceProcess\ServiceBase {
 
  public function DummyService() {
    $this->ServiceName = "DummyService";
    $this->CanStop = true;
    $this->CanPauseAndContinue = true;
    $this->AutoLog = true;   
  }
 
  public function Main() {
    System\ServiceProcess\ServiceBase\Run(new DummyService());
  }
 
  protected function OnStart($args) {
    parent::OnStart($args);
  }
   
  protected function OnStop() {
    parent::OnStop();
  }
   
}


What am I missing?

Re: Can you create a Windows service with Phalanger?

PostPosted: May 26th, 2014, 2:40 pm
by Jakub Misek
Hi,

try to specify [\Export] above the class declaration. This creates .NET like class usable by outer world.

Thanks,