473,655 Members | 3,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 - "LocalServi ce", "LocalSyste m" 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 13342
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.co m

"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message
news:04******** *************** ***********@mic rosoft.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 - "LocalServi ce", "LocalSyste m" 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.co m

"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message
news:04******** *************** ***********@mic rosoft.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 - "LocalServi ce", "LocalSyste m" 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.c om> wrote in
message news:OW******** ******@TK2MSFTN GP10.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.co m

"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message
news:04******** *************** ***********@mic rosoft.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 - "LocalServi ce", "LocalSyste m" 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
3410
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 function to change the local path for downloaded files. If the configured path is different from local drive C: the new path is selected. The program works fine in debug or release mode into Visual Studio. All downloaded files were placed on remote...
1
2393
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 10:24:48 AM run() error: System.IO.IOException: The specified network password is not correct. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare...
4
6847
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 actual windows service, which starts the first program as a child process (and then waits for the child process to terminate, restarting it should that ever happen). When run on its own from a shell window, myAction opens and reads its input...
1
9490
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 for accessing network drive in console apps, then call it with your windows service.. via windows API ..he..he that should work. Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As...
6
3040
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 the program (in the server) along with the working directory and the arguments (parameters). This works fine if I try to start programs whose executable file is present witin the local drives of the server. If the application is in a netwok drive,...
0
1253
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 service is running and try to access the file an exception is thrown: Exception: System.IO.IOException Message: Logon denied: unknown user or wrong password.
0
1285
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 kept on the network drive. If I run the code as a Windows Application I can access the database file. BUt when I run the Windows Service I get following error- "The Microsoft Jet database engine cannot open the file...
1
1861
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 code for hosting the web service and I've got a windows forms host (for debugging porposes) and a windows service host (the definitive exe). The issue here is that when I run the windows forms app it serves the web service correctly, but when I run...
16
34124
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 Windows Vista 32-bit w/ Office 2007 and keep getting the following error: -------------------------------------------------------------------------------------------------- SOURCE: Microsoft Office Excel MESSAGE: Microsoft Office Excel cannot...
0
8380
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.