How to make a windows service work to the network drive?

G

Guest

Hello,

I created a Windows Service in VB.NET, which is to purge files periodically
in the local system and also in the shared network drive. Here is my problem:

1. If I set the “Account†property of ServiceProcessInstaller to “Local
Service†or to “NetWorkServiceâ€, it won’t work for both local and network
shared directories.
(I use log on as this account “NT AUTHORITY\LocalService†for “Local
Service†or “NT AUTHORITY\NetWorkService†for “NetWorkService†in the
property window of Service)

2. If I set the “Account†Property of “ServiceProcessInstaller†to “Local
Systemâ€, then it works in the local directories, but it does not work in the
shared directories on the network drive.
(I switch to log on as Local system account in the property window of
Service).

Please help. Thanks in advance.

Miriam
 
N

Norman Yuan

It is just that simple: use an user account that has the appropriate
permissions on that network share. Obviously, any local account very likely
does not have permission on the said share. To use an account that can
access resources over the network, you need to use a network domain user
account to run that Windows service. For example, if you log onto your
network (with your user account) and you can access to that share, then you
can configure the said Windows service to run with your account (or another
account with the same privilege as you do) and the service should be able to
access the share.
 
G

Guest

Thank you very much for your response. I have two more questions;
1. Which "Account" property should I choose - "Local Service", or
"NetworkService" if I use "log on as this account ( my network login
account)"?

2. If I set "Account" property to "Local system", and I shared a directory
on another machine, let's say "$c:\", on my local, why it does not work?

Thanks again.

Miriam
 
C

Chris Dunaway

Miriam said:
Thank you very much for your response. I have two more questions;
1. Which "Account" property should I choose - "Local Service", or
"NetworkService" if I use "log on as this account ( my network login
account)"?

Neither! You need to use an account that has the necessary privledges.
 

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