Can you create a Windows service with Phalanger?

Discussion about the open-source Phalanger [?] project.

Can you create a Windows service with Phalanger?

Postby Marko » May 14th, 2014, 8:20 am

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?
Marko
 
Posts: 1
Joined: May 14th, 2014, 8:14 am

Re: Can you create a Windows service with Phalanger?

Postby Jakub Misek » May 26th, 2014, 2:40 pm

Hi,

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

Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 1 guest

cron

User Control Panel

Login

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 124 on September 25th, 2020, 6:57 am

Users browsing this forum: No registered users and 1 guest