What does log on/off from a windows service do?

0

Issue

I’ve got three questions:

  1. What does the log on option mean in services?

  2. What happens when a user logs off?

  3. Does the service stop?

For this log on option:
img1

Solution

Windows Services do not stop when a user logs off the computer. They run in the background. A service is always running, compared to an application which will get terminated when the user logs off.

More details have been discussed in this accepted answer by Microsoft contingent staff on MSDN.

"If you need an app to run while you are logged off then a service is one approach but you need to be very clear, a service is always running. You will not log in to start it. If you start a service then: a) it isn’t a service, and b) it will terminate when you log off. Services generally start automatically when Windows starts. You can manually start a service through the SCM but you cannot simply go to a command line or EXE and run it, that isn’t a service."

Another Microsoft Technet discussion that also clarifies the matter.

Since now you also added a photo:

The Log On Tab on the service allows you to give the service permission to log in as a specific user on the system to be able to access a protected resource that belongs only to that specific user. The user doesn’t have to be logged in for the service to access the resource.

So to answer your question: Windows Services do not stop when the user logs off, however, if you want the service to be able to access protected resources (files, etc.) of a specific user even when they’re not logged in, you need to provide the user credentials in the Log On tab of the service. This way, the service can "log in" to access those resources.

As for the Local System Account option, Microsoft details it in the documentation.

Answered By – GeoSn0w

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More