473,624 Members | 2,165 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 10780
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
3637
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
2215
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
4590
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
4447
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
1634
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
7115
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
6847
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
24131
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
8677
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8335
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,...
1
6110
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
5563
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
4079
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
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2605
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
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
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.