473,883 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FileSystemWatch er unable to watch network drive as a windows service

PLEASE HELP!!!!!!

Here is the exception that I am getting

Exception: System.Argument Exception
Message: The directory name W:\AudioFiles is invalid.
Source: System
at System.IO.FileS ystemWatcher.se t_Path(String value)
at DirMon.set_sour ceDirectory(Str ing value)

The service is running under local administrator account. The drive is
mapped and is accessible.

If I run the same code through an EXE and logged in as the same, it
works just fine.

The W:\AudioFiles is shared with unlimited users and full control.

This is driving me nuts.

Mar 20 '06 #1
6 10875
You probably need to load the users Profile when the service starts.

Another thing to try is using UNC paths instead.
<km******@gmail .com> wrote in message
news:11******** *************@z 34g2000cwc.goog legroups.com...
PLEASE HELP!!!!!!

Here is the exception that I am getting

Exception: System.Argument Exception
Message: The directory name W:\AudioFiles is invalid.
Source: System
at System.IO.FileS ystemWatcher.se t_Path(String value)
at DirMon.set_sour ceDirectory(Str ing value)

The service is running under local administrator account. The drive is
mapped and is accessible.

If I run the same code through an EXE and logged in as the same, it
works just fine.

The W:\AudioFiles is shared with unlimited users and full control.

This is driving me nuts.

Mar 20 '06 #2
Brendan,

Thanks for the reply. Can you point me in the right direction for
loading user's profile when the service starts?

Mar 20 '06 #3
You'll need to P/Invoke into the Win32 API.

One of the functions you're looking for is the LoadUserProfile (...) function
in userenv.

See http://www.pinvoke.net/default.aspx/...erProfile.html for the
details.

Is there a reason UNC paths aren't an option?

<km******@gmail .com> wrote in message
news:11******** **************@ j33g2000cwa.goo glegroups.com.. .
Brendan,

Thanks for the reply. Can you point me in the right direction for
loading user's profile when the service starts?

Mar 21 '06 #4
Brendan,

Thanks for the reply. The UNC paths are an option to use but I would
imagine the remote machine would ask for userid, password and domain
when attempting to access the UNC path. The tight deadline that is
looming on my head is making it look for a quick fix. With a mapped
drive, I could just set the "Reconnect at logon" property and never
again worry about providing the userid and password.

I am surprised to find that windows service does not have a
LoadUserProfile property that one could set. I believe the windows
service does not load the user's profile as a perfomance tweak, but the
option should always be with the developers to take the performance
hit.

Thanks
Kris--

Mar 21 '06 #5
I'm not 100% sure of the details, but you might be able to use UNC paths if
you run the service as a domain user who has access to the share on the
remote machine.

If services are run as users such as Local System or Local Service, they are
very limited.

Good luck with finding a solution.

<km******@gmail .com> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
Brendan,

Thanks for the reply. The UNC paths are an option to use but I would
imagine the remote machine would ask for userid, password and domain
when attempting to access the UNC path. The tight deadline that is
looming on my head is making it look for a quick fix. With a mapped
drive, I could just set the "Reconnect at logon" property and never
again worry about providing the userid and password.

I am surprised to find that windows service does not have a
LoadUserProfile property that one could set. I believe the windows
service does not load the user's profile as a perfomance tweak, but the
option should always be with the developers to take the performance
hit.

Thanks
Kris--

Mar 21 '06 #6
Thanks. I tried to monitor using UNC path and it seems to work. I will
implement impersonation if the service starts complaining. If not, I'm
good to go. Thanks a lot for the advice.

Mar 23 '06 #7

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

Similar topics

3
3663
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
2
2232
by: Jet Leung | last post by:
Hi all, I had made a program to watching files in my directory. I had used a instance of FileSystemWatcher to do my work.And I had add some events of the FileSystemWatcher , for example onChange, onRename and so on. And I had made this program as a windows service.As I know, if I delete a file from my directory, this behavior will active this program and do something what I want to do. But after I install this program as a windows service...
1
4631
by: John Lee | last post by:
Hi, I developed a filewatcher service to monitor file creation on a network drive - 90% time it works fine and from time to time I found out that the newly created file on that network drive does not trigger the event - all I have to do is to restart the service. I kind of suspect the reason is when the target matchine where monitored drive is on gets rebooted, the filesystemwatcher lost its "monioring" capability, is that true? if...
20
4534
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business logic layer(so far so good and easy).I initialize my class which is using a FileSystemWatcher in my Global.asax and everything works fine.I have found FileSystemWatcher class not very reliable and sometimes it behavies unexpectedly.I'm afriad that...
8
654
by: Pedro C. Valenzuela | last post by:
Hello, Does anyone know how a File System Watcher windows control works to detect file changes accross the network to a remote machine? I am trying to watch for new files in 30 different folders in a remote machine that has around 1000 folders. I dont know if it's wise to put one single watcher for the whole machine, or 30 different watchers because i dont know if the watchers take up bandwidth or processing power.
1
1644
by: Adrian | last post by:
I am trying to use FileSystemWatcher (FSW) to monitor a folder. The only problem is this folder is on FTP server located on DMZ (outside my domain) and FSW does not allow me to pass credentials in order to authenticate on that folder. Because of this, I mapped that folder on a computer within the domain. Now, I was able to build a Windows app using FSW to raise an event whenever a file was placed on FTP folder and it worked OK. The...
9
7136
by: Tushar | last post by:
Followup-To: microsoft.public.dotnet.general Does anyone know when is this event raised, is it: 1) When the file is created but may not have been closed 2) When the file is created AND it has been closed I am using this control in a Windows-Service I've developed. It works hoever the problem I'm having is that the file does not seem to be available when I receive this event. If I include a delay of a few seconds using Sleep(3000) for...
3
6861
by: webgreginsf | last post by:
I'm attempting to use the FileSystemWatcher class to monitor a folder on a remote server. My app is running as a Windows service, currently on an XP machine, but it will be on Server 2003 in production. Everything works fine when I set the Path to a local drive (i.e. "C:\Test"). However, when I attempt to set the Path to a UNC path to my remote folder (i.e. "\\servername\share" with an actual server and share name of course), I receive...
5
24231
by: Goran Djuranovic | last post by:
Hi all, I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't receive any errors, it is just that FileSystemWatcher doesn't see any files dropped in the folder. What could be wrong? Thanks Goran
0
9945
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
9797
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
10422
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7136
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5807
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
6006
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4622
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.