FileSystemWatcher not monitoring UNC folder

Y

Yash Ganthe

The MSDN documentation says that FSW can be used for monitoring
network paths and folders. I tried it with a simple application and
monitored \\server\share. This worked fine. I was logged in as a
domain user. The shared folder has full access granted to the domain
user.

When I use the FSW in a Win Service, the event handlers get
registered. But they are never invoked. The FSW does not respond to
the registered events. The Win service is configured to run using the
same domain user account.
The PC on which I am running the FSW and the Server, are both running
on Win XP SP2. The Win service works fine with a local folder.

This is the code:
filesystemwatcher = new FileSystemWatcher();
string pathval = ConfigurationManager.AppSettings
["pathval"];
string filterval = ConfigurationManager.AppSettings
["filterval"];
filesystemwatcher.Path = pathval;

filesystemwatcher.Filter = filterval;
filesystemwatcher.NotifyFilter =
NotifyFilters.LastAccess | NotifyFilters.LastWrite |
NotifyFilters.FileName | NotifyFilters.DirectoryName;
filesystemwatcher.InternalBufferSize += 81920;

filesystemwatcher.IncludeSubdirectories = true;
filesystemwatcher.Created += new
System.IO.FileSystemEventHandler(fsw_Changed);
filesystemwatcher.Changed += new
System.IO.FileSystemEventHandler(fsw_Changed);

filesystemwatcher.EnableRaisingEvents = true;

What could be the problem?

Thanks,
Yash
 
C

Cowboy \(Gregory A. Beamer\)

My first thought is "what account are you running the service under". Can
you log in with that account and see if the app, not service, is still
working?

--
Gregory A. Beamer
MCP: +I, SE, SD, DBA

*********************************************
| Think outside the box!
|
*********************************************
 
Y

Yash Ganthe

As mentioned in the original post, the service is running under the
same account with which the FSW works with a simple application.

-Yash


My first thought is "what account are you running the service under". Can
you log in with that account and see if the app, not service, is still
working?

--
Gregory A. Beamer
MCP: +I, SE, SD, DBA

*********************************************
|                     Think outside the box!
|



The MSDN documentation says that FSW can be used for monitoring
network paths and folders. I tried it with a simple application and
monitored \\server\share. This worked fine. I was logged in as a
domain user. The shared folder has full access granted to the domain
user.
When I use the FSW in a Win Service, the event handlers get
registered. But they are never invoked. The FSW does not respond to
the registered events. The Win service is configured to run using the
same domain user account.
The PC on which I am running the FSW and the Server, are both running
on Win XP SP2. The Win service works fine with a local folder.
This is the code:
filesystemwatcher = new FileSystemWatcher();
               string pathval = ConfigurationManager.AppSettings
["pathval"];
               string filterval = ConfigurationManager.AppSettings
["filterval"];
        filesystemwatcher.Path = pathval;
               filesystemwatcher.Filter = filterval;
               filesystemwatcher.NotifyFilter =
NotifyFilters.LastAccess | NotifyFilters.LastWrite  |
NotifyFilters.FileName | NotifyFilters.DirectoryName;
               filesystemwatcher.InternalBufferSize += 81920;
               filesystemwatcher.IncludeSubdirectories = true;
               filesystemwatcher.Created += new
System.IO.FileSystemEventHandler(fsw_Changed);
               filesystemwatcher.Changed += new
System.IO.FileSystemEventHandler(fsw_Changed);
               filesystemwatcher.EnableRaisingEvents = true;
What could be the problem?
Thanks,
Yash
 
D

Damien

The MSDN documentation says that FSW can be used for monitoring
network paths and folders. I tried it with a simple application and
monitored \\server\share. This worked fine. I was logged in as a
domain user. The shared folder has full access granted to the domain
user.

When I use the FSW in a Win Service, the event handlers get
registered. But they are never invoked. The FSW does not respond to
the registered events. The Win service is configured to run using the
same domain user account.
The PC on which I am running the FSW and the Server, are both running
on Win XP SP2. The Win service works fine with a local folder.

This is the code:
                filesystemwatcher = new FileSystemWatcher();
                string pathval = ConfigurationManager.AppSettings
["pathval"];
                string filterval = ConfigurationManager..AppSettings
["filterval"];
                filesystemwatcher.Path = pathval;

                filesystemwatcher.Filter = filterval;
                filesystemwatcher.NotifyFilter =
NotifyFilters.LastAccess | NotifyFilters.LastWrite  |
NotifyFilters.FileName | NotifyFilters.DirectoryName;
                filesystemwatcher.InternalBufferSize +=81920;

                filesystemwatcher.IncludeSubdirectories = true;
                filesystemwatcher.Created += new
System.IO.FileSystemEventHandler(fsw_Changed);
                filesystemwatcher.Changed += new
System.IO.FileSystemEventHandler(fsw_Changed);

                filesystemwatcher.EnableRaisingEvents =true;

What could be the problem?

Thanks,
Yash

The community content for FileSystemWatcher on MSDN specifically
mentions problems with it working across the network when the Internal
Buffer size is altered, and gives a link to
http://blogs.msdn.com/kimhamil/arch...-drive-after-changing-internalbuffersize.aspx.
Any help?

Damien
 

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