Page 1 of 1

Question of running app as a service

Posted: Thu Apr 14, 2005 8:29 am
by ricardo
1.- How can i run a program not as a service from a service (my own app running as a service)?
Im running some app as service, but if i tried to run some other app it starts as a service, buts as is not s service is crashes. I want to run from my service app some other app not as a service, its possible?

2.- I read Rings made a service lib, where can i found it?

Thanks in advance

Posted: Thu Apr 14, 2005 3:26 pm
by Tommeh
1) Yes if you start an app from a service, it trys to start it under the current username (services) in which it can't run, so you have to make it start the program under another username, using runas or equiv

2) Rings NT lib was part of his PB power pack, talk to him about it :-) I dunno if he wants it distributed

Posted: Thu Apr 14, 2005 3:59 pm
by ricardo
1) But using runas requieres username/password, right?

2) Which PB power pack? Where is the link to see it?

Posted: Thu Apr 14, 2005 4:00 pm
by Rings
Ricardo, you got a pm from me

Posted: Thu Apr 14, 2005 5:23 pm
by Tommeh
Yes it requires username/password, but also as a service, you can create a user :) or hope the guest account is active

Re: Question of running app as a service

Posted: Thu Apr 14, 2005 8:38 pm
by Max.
ricardo wrote:1.- How can i run a program not as a service from a service (my own app running as a service)?
Im running some app as service, but if i tried to run some other app it starts as a service, buts as is not s service is crashes. I want to run from my service app some other app not as a service, its possible?
A program that you run from within a service does NOT run as service, but as a regular application.

The trouble is, if you run the service as SYSTEM service, other programs run under this account as well, which might prevent it from things, like accessing a network share.

If you want to use a GUI and have users input data, you need to select "allow to interact with service" in the user account.

To bypass the networking restriction, you can have the program run under a seperate account (needs the LogonAsService privilege). But then you get into another trouble: you cannot interact with the GUI (output/input). Not possible except with some very low level hacks.

The usual way, to realize such services - as I assume you want to do is - to split the functionality into 2 parts:

1. The service itself, running as SYSTEM or another (priviledged?) user
2. A helper program, launched at each startup, running as the logged on user.

The service communicates with the helper program, exchanges data and each part does the tasks it can do.

This is how basically all apps run, that require this setup; like Sophos Anti-Virus, NetInstall and so on.

Posted: Wed May 11, 2005 10:08 am
by kalau
So. will it generally be possible to write an app as a service?
Here's what I'm planning: I'm running a web server (win 2003 IIS, .NET framework), and I want to receive data via an explicit port. So my app has to listen to a certain port for any data connection in order to write this data into a mysql database.

But I don't want to bother and check whether the application is running, so I thought of running it as a service, so windows will be able to restart this app automatically if it crashed.

Will this be possible with PB? If so, is there any snippet of code where s.o. already realized something like this kind of service?

Thanks for any hint!

best regards

kalau

Posted: Wed May 11, 2005 1:13 pm
by FloHimself
kalau wrote:So. will it generally be possible to write an app as a service?
viewtopic.php?t=14488