BarisTa
BarisTa

Reputation: 1

Windows servce won't run if no user logged into server

I created a windows service that's basically a file watcher that wont run unless a user is logged into the machine its on.

The service is running on a Windows Server 2003 machine. It is designed to listen for excel files in a folder. When there is a excel file, it starts to send some information to a web service. When it's done, it copies the processed file to a archive folder.

Can anyone help me?

Best regards Baris

Upvotes: 0

Views: 1214

Answers (3)

eFloh
eFloh

Reputation: 2158

When you actually only want to run when someone is logged in, do not use a service but an autostart application in that case.

If you have to be a service because of account privileges, the service may detect the current logins itself, but you may combine a service with a client (autostart) application that connects to the service. That way, you can also show tray incos, status informations and enable the user to control your service using the client application. Using Win7 and higher, services themselves (running in session 0) can no longer display UI interactions on the user's desktop.

Keep in mind that there may be multiple users logged in on current operating systems...

Upvotes: 0

Kristof
Kristof

Reputation: 3315

What i always do in a scenario like that is give the user logon as batch job and logon as a service rights.
1 of these 2 will most likely fix your problem.
You can configure this in the local group policy editor as described here

Be aware though that if your computer is in a domain it is possible that the group policy gets pushed to the server every 15 mins so you might have to talk to a system admin to get things sorted.

Upvotes: 0

Michal B.
Michal B.

Reputation: 5719

Run it as a user that has rights to log on as service on the machine. Make sure this user has an access to the directory you watch.

Upvotes: 1

Related Questions