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

FileSystemWatcher invalid directory name

I have written a windows service to watch a folder for newly created
documents. Works fine when watching directories on my local machine, but
always get a "directory invalid" error when I either try to watch a UNC path
or mapped drive.

Any ideas?

Thanks!
Wes
Jun 14 '07 #1
5 6578

That's funny, I have the opposite problem where I get no error if the
unc path doesn't exist. :-)

Are you sure the user that the windows service is running as has
access to the unc path?

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On Thu, 14 Jun 2007 14:01:01 -0700, stahlerw
<st******@discussions.microsoft.comwrote:
>I have written a windows service to watch a folder for newly created
documents. Works fine when watching directories on my local machine, but
always get a "directory invalid" error when I either try to watch a UNC path
or mapped drive.

Any ideas?

Thanks!
Wes
Jun 15 '07 #2
I am running it on my machine under a domain account that has access.
I have also noticed that I get the error the first time I create a new
document in the directory, subsequent attempts don't trigger or raise an
error.

So just to verify, you have seen it work with UNC path?
"Samuel R. Neff" wrote:
>
That's funny, I have the opposite problem where I get no error if the
unc path doesn't exist. :-)

Are you sure the user that the windows service is running as has
access to the unc path?

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On Thu, 14 Jun 2007 14:01:01 -0700, stahlerw
<st******@discussions.microsoft.comwrote:
I have written a windows service to watch a folder for newly created
documents. Works fine when watching directories on my local machine, but
always get a "directory invalid" error when I either try to watch a UNC path
or mapped drive.

Any ideas?

Thanks!
Wes

Jun 15 '07 #3

Yes, we use FileSystemWatcher in an asp.net app using impersonation.
We impersonate the authorized user when setting up the watcher and
then again when the event is raised ('cause event is raised on a
different thread).

It works fine when the unc is correct and setup. When we install our
app in an environment where the unc share is not setup properly, we
get no error, just no events.

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Thu, 14 Jun 2007 19:11:01 -0700, stahlerw
<st******@discussions.microsoft.comwrote:
>I am running it on my machine under a domain account that has access.
I have also noticed that I get the error the first time I create a new
document in the directory, subsequent attempts don't trigger or raise an
error.

So just to verify, you have seen it work with UNC path?
Jun 15 '07 #4
Thanks Sam.
I will investigate the impersonation route.

"Samuel R. Neff" wrote:
>
Yes, we use FileSystemWatcher in an asp.net app using impersonation.
We impersonate the authorized user when setting up the watcher and
then again when the event is raised ('cause event is raised on a
different thread).

It works fine when the unc is correct and setup. When we install our
app in an environment where the unc share is not setup properly, we
get no error, just no events.

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Thu, 14 Jun 2007 19:11:01 -0700, stahlerw
<st******@discussions.microsoft.comwrote:
I am running it on my machine under a domain account that has access.
I have also noticed that I get the error the first time I create a new
document in the directory, subsequent attempts don't trigger or raise an
error.

So just to verify, you have seen it work with UNC path?
Jun 15 '07 #5

Worth looking into, but it shouldn't be necessary in your case.

I need it 'cause I'm running in an asp.net app which by default does
not have access to the unc. In your case, the windows service is
already running under an account that has access, so impersonation
shouldn't be necessary.

Sorry I can't help more...

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On Thu, 14 Jun 2007 19:37:00 -0700, stahlerw
<st******@discussions.microsoft.comwrote:
>Thanks Sam.
I will investigate the impersonation route.

"Samuel R. Neff" wrote:
>>
Yes, we use FileSystemWatcher in an asp.net app using impersonation.
We impersonate the authorized user when setting up the watcher and
then again when the event is raised ('cause event is raised on a
different thread).

It works fine when the unc is correct and setup. When we install our
app in an environment where the unc share is not setup properly, we
get no error, just no events.

Sam
Jun 15 '07 #6

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

Similar topics

0
by: A.S. | last post by:
When i use FileSystemWatcher to monitor a local directory on my machine ,it works fine.But I need to monitor a file on a different server.So i set FileSystemWatcher1.path="\\server1\App\Data" ...
1
by: Mike | last post by:
I'm running into a problem where the FSW events report all filenames in lower case. (The directory portion is okay, just the leaf file name is broken.) I found this thread from 6/02 stating as...
13
by: David | last post by:
I have been working on trying to write a directory watcher service. One of the requirments is that it be able to watch multiple directories, not sub directories of one parent directory, but just...
20
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...
1
by: PadovaBoy | last post by:
Hi! I try to develop a simple system for monitoring a sub directory of a web site and remake an xml file every time a sub-dir change it's name. I don't wont to use a window.service because, i want...
4
by: Cfleischer | last post by:
I have created a service that uses a fileSystemWatcher to monitor the creation of files on an ftp server. The service will run on our database server and monitor a remote directory. It worked...
9
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...
3
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...
2
by: Steve | last post by:
I have a FileSystemWatcher watching a directory where I will add and update files. When it detects a change, I search through all the files and update my list of files in the UI. This works fine....
12
by: ljh | last post by:
Has anyone else noticed that the FileSystemWatcher raises the changed event twice when a file is changed? Do you have any idea why this is the case?
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.