W2K3 Service w/ UNC Access, Local Disk Access, and DB Access

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hi,

I am working on a project that requires a Windows Service which
performs the following file transfer functions.

1. It monitors a specific local directory on a Windows 2003 Server.
2. When it finds files with a specific extension, it queries a SQL
Server database to determine what workstation will be the destination
of a File.Copy.
3. It copies those files to the appropriate workstations on the LAN,
using the File.Copy command.

The network does not have a domain controller. The server is a
standard Windows 2003 Server, which runs IIS and MSDE, servicing a web
application. This web application creates files in a configurable
location on the server, which have to be moved to workstations on the
network, in order to free up the space on disk.

These files are backed up from the workstations with BackupExec
nightly.

Here are my problems.

1. When I configure the Windows Service as Local System, it does not
have access to mapped drives or UNCs.
2. When I configure the Windows Service as Network Service, it does
not have access to local files. I haven't gotten far enough to
determine if it has access to SQL Server.
3. When I configure the Windows Service as a User, with a local user
account, it doesn't install, even if I configure the local user with
"logon as service" permissions.
4. I do not have a domain controller in this small office, so I cannot
configure this service with a domain user.

When I build the application as a Windows application, it works.

So what do I need to do to make a Windows Service have local disk
access, database access, and UNC access to public shares on the LAN?

Thanks.
 
Run it under the context of a user that has appropriate ACLs on the file
system. This same user can be given appropriate db permissions.
 
nal said:
Run it under the context of a user that has appropriate ACLs on the file
system. This same user can be given appropriate db permissions.

Thanks for your response. I've already tried this, but the local user
setting causes the installation to fail, even when I set the "Logon as
Service" permission for the local user.
 
Willy Denoyette said:
It should not fail, how did you specify your local account?
Willy.

I go to Computer Management/Local Users and Groups. I create a Local
User. I assigned the user to the Administrators group. Then I go to
Local Security Policy, and assign that user the "Logon as Service"
permission.

Then I build the windows service with User access specified, and I put
the user's account name and password in the code. Then I rebuild the
deployment application. I've tried putting the user's name in the code
in the following ways to no avail.

username password
computer\\username password
..\\username password

When I run it, I get the user permissions error, and the installation
fails.

The network on which I'm testing has a domain controller. However, I
cannot rely on this because the network where the application will be
installed has no controller.

Thanks again for your responses.
 
computer\\username password

Is the correct format for the ServiceProcessInstaller.Username property.

When exactly do you get the error, when running the installutil or when
starting the service?

Willy.
 
Willy Denoyette said:
Is the correct format for the ServiceProcessInstaller.Username property.

When exactly do you get the error, when running the installutil or when
starting the service?

Willy.

I see the problem. I was putting the username in the password property
and vice versa. For some reason, I assumed that the Username would be
first.

Thanks for your assistance.
 
Back
Top