FileSystemWatcher invalid directory name

G

Guest

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
 
S

Samuel R. Neff

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
 
G

Guest

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?
 
S

Samuel R. Neff

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
 
S

Samuel R. Neff

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top