473,379 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Windows service accessing the network

I need to write a windows service, and the only way it can access a shared
drive on a file server on the network is if the installer is put in "User"
mode - "LocalService", "LocalSystem" and "NetworkService" don't work. i.e. it
can't access the shared drive. But in "User" it can.
But I don't want it in user mode, if possible. I would rather it be a
service. Is there any way to do it?

Nov 16 '05 #1
3 13272
Bonj,

You don't have to have it be in "user" mode, but rather, have the
service run as a user which can access the network drive. You can restrict
the other rights of that account easily.

You should also be able to have it run as NetworkService, and then set
the permissions on the share to allow NETWORK access to it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
I need to write a windows service, and the only way it can access a shared
drive on a file server on the network is if the installer is put in "User"
mode - "LocalService", "LocalSystem" and "NetworkService" don't work. i.e.
it
can't access the shared drive. But in "User" it can.
But I don't want it in user mode, if possible. I would rather it be a
service. Is there any way to do it?

Nov 16 '05 #2
> You don't have to have it be in "user" mode, but rather, have the
service run as a user which can access the network drive. You can restrict
the other rights of that account easily.
When I say "User" mode, what I mean is the service when the Account property
of the service process installer set to "User". I'd rather avoid this if
possible, but am not that fussed.

You should also be able to have it run as NetworkService, and then set
the permissions on the share to allow NETWORK access to it.
This would obviously be the optimal solution, but unfortunately I don't have
control over the network share.


Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
I need to write a windows service, and the only way it can access a shared
drive on a file server on the network is if the installer is put in "User"
mode - "LocalService", "LocalSystem" and "NetworkService" don't work. i.e.
it
can't access the shared drive. But in "User" it can.
But I don't want it in user mode, if possible. I would rather it be a
service. Is there any way to do it?


Nov 16 '05 #3
This is not correct, NETWORK is a SID placed in a token that grants access
to the network services(the windows server and/or windows client service),
NOT to the resources like shares pipes etc. A token that has no NETWORK Sid
can't access the network.

NetworkService and LocalSystem are using "machine account" credentials to
access network resources, as such, you need a W2K/W2K3 AD domain realm for
this to work (machine accounts are regular "domain user" accounts in AD).
LocalService uses "anonymous" credentials to access network resources.
Depending on the service account type you have to set the ACL to grant the
required access right for the "machine" or "anonymous logon" account.

Willy.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OW**************@TK2MSFTNGP10.phx.gbl...
Bonj,

You don't have to have it be in "user" mode, but rather, have the
service run as a user which can access the network drive. You can
restrict the other rights of that account easily.

You should also be able to have it run as NetworkService, and then set
the permissions on the share to allow NETWORK access to it.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
I need to write a windows service, and the only way it can access a shared
drive on a file server on the network is if the installer is put in
"User"
mode - "LocalService", "LocalSystem" and "NetworkService" don't work.
i.e. it
can't access the shared drive. But in "User" it can.
But I don't want it in user mode, if possible. I would rather it be a
service. Is there any way to do it?


Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Max Baki via .NET 247 | last post by:
I all, i've write a sample ftp Windows service which download files and copy them on remote share or remote mapped drive (the service works fine on local drives). This part of code is the...
1
by: Daniel Xiao | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004...
4
by: marc.gibian | last post by:
I am writing a small Windows Service in C#. It is structured as two C# programs, one, let's call it myAction, that runs as a command line program and a second, let's call it myWrapper, that is the...
1
by: mbah Sumani via .NET 247 | last post by:
(Type your message here) I Think it's the stupidness of Windows. Why the service can't access network drive but console apps or windows application can do it? So my suggestion is make the program...
6
by: Bijesh | last post by:
Hi All, I've developed a Windows Service that acts as a remoting server (.NET Remoting). The client(user) is able to connect to the server and start a program by giving the executable path of...
0
by: Chris | last post by:
Hello, I have writen a windows service accessing files on a shared network drive. I configured the service running under a network account which can access the network share. But, when my...
0
by: dinoo | last post by:
I did not find the right forum to post this issue, please excuse me for this. But I need the help here very badly. I am having a Windows Service in .NET which is accessing a MDB file which is...
1
by: Diego L Espiñeira | last post by:
Hi all!!! I am trying to build a windows service that hosts a web service using the classes in System.Web.Hosting namespace. I have a class library called Digicard.WebServiceHost containing the...
16
emibt08
by: emibt08 | last post by:
Hello fellow programmers. I am working on a project that is a windows service. It should open an excel file and read it and it worked good on WinXP SP2 w/ Office 2003. Now the customer upgraded to...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.