473,405 Members | 2,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,405 software developers and data experts.

Windows service problem with network drive access

Hi all,

I have created a windows service that has a file watcher and does some operation after it reads that file. i developed it in my local machine and installed the service on server. i have changed the file path and everythng according to server drives.

we all in the office share some network drives in which ppl will keep pasting that file and the service on server has to pick it up. which its not doing. when i paste it in netwrok drive folder it picks up and works properly. but when someone else does that service doesn't work.when i check in the server the service has stopped. i had to start it manually.

i researched alot and found that windows service donot access network drives.i tried setting up installer acount to localservice, localsystem and also network service. nothng works. should i try user? i assumed it wont work since lot of them have to use this service. also all of them have read and write permissions to the network drive.

i dont understand what am i missing here. why does the service stop for other users. it'l be gr8 if someone can throw some light on this.

Thanks
Ayush
Jul 11 '08 #1
17 3175
Hi all

let me make my question a little more clear. the windows service that i have created in my local system is installed on a server. and everyone accesss a network drive thats one of the folder in the server.

now my service works fine . but tte problem is it stops when some users use that network drive. like i put a file in that network drive it takes in, when user b puts a file it works as expected, but some user c puts a file in that network drive, it does not work and when i go in and check, the service actually stops and i have to restart the service. its wierd.

i have been reseraching for 3 days for this. this is really frustating. if anyone hasany clue pls let me know and i will research in that direction.

thanks,
Ayush
Jul 15 '08 #2
Plater
7,872 Expert 4TB
Are you doing any error checking in your service? Have it print out logs of what is going on at various places in the program?
Jul 15 '08 #3
Hi,

Thanks for you repaly. I debugged the service on my local machine. there are no bugs. i cannot debug it on the server. when i checked the event log on server it says service has terminated unexpectedly.

i dont understand why is it runing for some users and not for other users. its working for the creator that is me and admin. its not working for other users. service just stops as soon as another user access that network drive.

Ayush
Jul 16 '08 #4
and also i have try catch blocks every where and it writes the error to an error file in a folder. but the problem is service is not starting at all to go to any try catch block. i have added a try catch block in the start and stop events of the service. im trying to catch the error.

if any one has anymore suggestions please help me out.

Ayush
Jul 16 '08 #5
Plater
7,872 Expert 4TB
Is the service run as administrator?
Jul 16 '08 #6
No it does not run as administrator. should i have to impersonate.

Please let me know how should i make it run as an administrator.

Ayush
Jul 17 '08 #7
Plater
7,872 Expert 4TB
No it does not run as administrator. should i have to impersonate.

Please let me know how should i make it run as an administrator.

Ayush
Go into services.msc and right click on your service and choose properties. On the Log On tab, change to an administrator account.
that might help?
Jul 17 '08 #8
Thanks for replying so quickly.

right now in the logon I have NT AUTHORITY\NetworkService as account and its password. so I should change this to admin userID and password?
Jul 17 '08 #9
Plater
7,872 Expert 4TB
I'm not sure that the login credentials are even whats at fault here.
I have no idea why it can read the local share directory sometimes but not other times.
Jul 17 '08 #10
Ok. I noticed one thing the user for whom this service is not working does not have access to login to the server. he can access the network drive though.

service stops when he tries to put the file in network drive but when i restart it, it works. its not that the service does not work for him. its just that it stops. thats wierd behavior.
Jul 17 '08 #11
Plater
7,872 Expert 4TB
Does your service try to do anything like examining the username of the person who put the file in the directory?
Jul 17 '08 #12
No it doesn't check any userid and password.
Jul 17 '08 #13
Plater
7,872 Expert 4TB
Hmm very strange. And you're saying it never throws an access exception, like maybe when that user creates the file it gets marked with wierd privileges or something.
Could you just create an account for that user?
Jul 17 '08 #14
i have try,catch blocks everywhere even at the start and stop of the service. if an exception is caught it writes to an error file. but the problem is service just stops before going to any try catch block. the only thing that i can see in even log is that this service has stopped unexpectedly.

how can i create an account for this user?
Jul 17 '08 #15
Plater
7,872 Expert 4TB
how can i create an account for this user?
Well I don't know, but you said it happens when the user with no account on the server accesses the share directory. So I figure if you get them an account so they are like everyone else, you will not see the problem?
Jul 17 '08 #16
Oh ok got it. well its a development server and not everyone should have access to it. its companies rule i cant do much about it.
if nothing works out i am planning to install the service in that users machine and change the file paths accordingly. thats my last option.
Jul 17 '08 #17
Hi,

I have got it running somehow. this is the work around i used.

if somebody access the shared drive and the service stops then i made it to restart again with in some intervel. Right click on service name and go to recovery tab in that select first failure action as restart the service. and in the service, in start action, i check for files in the the folder. therefore the service which is stopped unexpectedly will restart and if a file exists it will do what ever it has to do.

my service actually moves the file from the folder and copies it to archives after it has used it.so usually the folder is empty. so above procedure worked for me. but i wish i can figure out a better way to do this.

thanks for all you help Plater
Jul 23 '08 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

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: 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...
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...
5
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a...
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”...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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 projectplanning, coding, testing,...

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.