FileSystemWatcher events not firing under ASP.NET

G

Guest

Hi

We just upgraded to VS2005 but now the FileSystemWatcher no longer fires
events under ASP.NET. We use the following code (which works under 1.1):

[PermissionSet(SecurityAction.Demand, Name="FullTrust")]
private void AddFileSystemWatcher(string fileName)
{
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = System.IO.Path.GetDirectoryName(fileName);
watcher.Filter = System.IO.Path.GetFileName(fileName);
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.EnableRaisingEvents = true;
watcher.Changed += new FileSystemEventHandler(watcher_Changed);
watcher.Error += new ErrorEventHandler(watcher_Error);
watcher.Disposed += new EventHandler(watcher_Disposed);
watchers.Add(watcher);
}

This code is called from within a public static method on a class that has
the private static watchers property. I have VS Studio with SP1 beta
installed and the ASP.NET project is a WebApplicationProject running under
the ASPNET account in IIS on Windows XP SP2

Thanks
 
G

Guest

Hi,

I now know exactly what the problem is. The Changed event does not fire when
the file is modified from within VS2005. If I use notepad to change the file
then the event fires immediately (twice actually).
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top