FileSystemWatcher not monitoring UNC folder

  • Thread starter Thread starter Yash Ganthe
  • Start date Start date
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
 
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!
|
*********************************************
 
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
 
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
 
Back
Top