Windows Service and Remote Drive connection

G

Guest

Hi,

This is my first coding experience with Windows Service. 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.
 
S

Stephany Young

1. Nothing. Yes.

2. No effect. No.

Services start when the machine starts. If it appears that the service
starts when you login then it is only because you login soon after the
machine starts or you have the machine set to auto-login.
 
C

C.C. \(aka Me\)

Another note is that you specify the "user" or "account" to run the service
as when you install it. Services do not have a desktop "user" that they
interact with (that is why they cannot use any GUI elements) but insted use
the account you defined.

So in otherwords: Services start/stop with the "computer" and not a "human
user".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top