What happens to WinService when logged off?

pparker

Member
Joined
Jan 14, 2006
Messages
7
Programming Experience
Beginner
Hi,I have a Windows Service that connects to remote drives using UNC paths (no drive letters). I make the connection with the remote drive in my OnStart procedure. I run the service with my username so that the service can have enough privelege to do its job. My questions are:1. What happens to the connections when I log off? I understand that service runs in the background. Will it maintain the UNC connection when no one is logged on?2. What happens when someone other than me logged on to the computer? Will it invoke my OnStart procedure again (and therefore try to make the UNC connection again)? My log shows the service invokes the OnStart procedure everytime someone is logged on, but never runs the OnStop procedure when that person logs off. Thanks for the help.
 
Windows services runs in a system space seperated from that of user desktops, you can let a service log in as user if that user account is granted the rights to log in as service. This will not affect regular user log in/out, even if the service uses the same account as a desktop user logging in/out. If service is set to automatic startupmode it will start when system starts. Unless a user stops it, it will stop when system shuts down. The service will not start and stop with different users logging in/out. My tests with writing information to Event Log of every service event prove this, and I can not reproduce what you describe with OnStart event. A services UNC connection will maintain for as long it uses it.
 
Back
Top