473,387 Members | 1,497 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,387 software developers and data experts.

Is a Service not allowed to write to a network share?

I'm working on a system that has a several computers that run an
alerting system. There are 2 "Host" machines that have no user
interface, and one "Admin" station that has an Administrator's
application for configuring and reporting. They are on a simple
local network, just the 3 machines, no wider access.

We do a certain amount of communication between them, using UDP and
MessageQueueing and also in one instance a VB.Net Windows Forms
application on the Admin station, that has a button that a user can
click that will write a new ini file for the system and send it to a
network share on the Hosts, named "DataShare". It is simple enough,
just using File.Delete and File.Copy, with the normal syntax --
File.Copy("C:\IniFileFolder\Configuration.ini",
"\\HostA\DataShare\Configuration.ini"). It's been working for a long
time.

There is also a Windows Service application written in VB.Net, running
on the Admin station. It runs as a Service and receives and processes
stuff coming in on the MessageQueue. We want to use it as a means of
deleting old, out-of-date log files on the Hosts. There are many
logs kept, each one starts a new dated log file once per day, and we
figure we will delete logs older than 10 days. I wrote a simple
method that works just fine, but I did it as a development version in
a Forms application first, since that's easier to debug. I copied the
method's code into the Service, built it, installed it, and now I find
that it throws an Exception

System.UnauthorizedAccessException: Access to the path
"\\HostA\DataShare\Configuration.ini" is denied.

The exact same code, it works in the Forms version, fails in the
Service version.

Is there some security aspect to Windows XP Pro that does not allow
file access to a Service running on another machine?

Nov 21 '05 #1
2 1762
Things to check:
1. Permissions. both file, application, and directory.
2. Is another process holding the ini file exclusively.
If all else fails, you could send a msg via message queue that creates a
local process to handle the .ini file.
"felecha" <fe*******@yahoo-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
I'm working on a system that has a several computers that run an
alerting system. There are 2 "Host" machines that have no user
interface, and one "Admin" station that has an Administrator's
application for configuring and reporting. They are on a simple
local network, just the 3 machines, no wider access.

We do a certain amount of communication between them, using UDP and
MessageQueueing and also in one instance a VB.Net Windows Forms
application on the Admin station, that has a button that a user can
click that will write a new ini file for the system and send it to a
network share on the Hosts, named "DataShare". It is simple enough,
just using File.Delete and File.Copy, with the normal syntax --
File.Copy("C:\IniFileFolder\Configuration.ini",
"\\HostA\DataShare\Configuration.ini"). It's been working for a long
time.

There is also a Windows Service application written in VB.Net, running
on the Admin station. It runs as a Service and receives and processes
stuff coming in on the MessageQueue. We want to use it as a means of
deleting old, out-of-date log files on the Hosts. There are many
logs kept, each one starts a new dated log file once per day, and we
figure we will delete logs older than 10 days. I wrote a simple
method that works just fine, but I did it as a development version in
a Forms application first, since that's easier to debug. I copied the
method's code into the Service, built it, installed it, and now I find
that it throws an Exception

System.UnauthorizedAccessException: Access to the path
"\\HostA\DataShare\Configuration.ini" is denied.

The exact same code, it works in the Forms version, fails in the
Service version.

Is there some security aspect to Windows XP Pro that does not allow
file access to a Service running on another machine?

Nov 21 '05 #2
turned out to be wonderfully simple, but not in the docs.

If I set the code to Username = "MachineName\AccountName" it works.
It shows up in the Services console as ".\AccountName". I had
already tried setting Username = ".\AccountName", which got the error
saying that was an invalid account.

Very strange, but hey, as my favorite professor always said, "In the
end, working is good."

Nov 21 '05 #3

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

Similar topics

5
by: Niloday | last post by:
Hi All, I am trying to access a mapped network drive from a service that I have created. The service needs to create/delete folders/files on a network drive. When I tried to connect to a...
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...
3
by: Bonj | last post by:
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...
2
by: Dave Stewart | last post by:
I am attempting to write a vb.net windows service that will automate various file movements on my network. When I attempt to access files on a mapped drive or UNC file share, I get exceptions...
3
by: Miriam | last post by:
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”...
27
by: pisquem | last post by:
I am building an windows service that is to be deployed on a windows server 2003 and I want to have activity written to the event log, I want its own log called ('CustomLog') Below is what I...
10
by: dermot | last post by:
I have wrriten a small windows service application in visual studio ..net 2003 which listens for incoming FTP files. These files would overwrite over time due to duplicate file names. However any...
0
by: savajx1 | last post by:
I am loading signed assemblies from a network share. The assemblies are NOT INSTALLED in the GAC as they are part of an enterprise distributed application implemented as a windows service that...
2
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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...
0
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...

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.