![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | FileSystemWatcher not monitoring UNC folder 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 System Specs![]() |
| | #2 (permalink) |
| | Re: FileSystemWatcher not monitoring UNC folder 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! | ********************************************* "Yash Ganthe" <yashgt@xxxxxx> wrote in message news:59ae6ba0-db18-4f08-842d-d6527641b429@xxxxxx Quote: > 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 System Specs![]() |
| | #3 (permalink) |
| | Re: FileSystemWatcher not monitoring UNC folder As mentioned in the original post, the service is running under the same account with which the FSW works with a simple application. -Yash On May 6, 6:41*am, "Cowboy \(Gregory A. Beamer\)" <gbwo...@xxxxxx> wrote: Quote: > 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! > | > *********************************************"Yash Ganthe" <yas...@xxxxxx> wrote in message > > news:59ae6ba0-db18-4f08-842d-d6527641b429@xxxxxx > > > Quote: > > 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. Quote: > > 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. Quote: > > This is the code: > > filesystemwatcher = new FileSystemWatcher(); > > * * * * * * * *string pathval = ConfigurationManager.AppSettings > > ["pathval"]; > > * * * * * * * *string filterval = ConfigurationManager.AppSettings > > ["filterval"]; > > * * * * filesystemwatcher.Path = pathval; Quote: > > * * * * * * * *filesystemwatcher.Filter = filterval; > > * * * * * * * *filesystemwatcher.NotifyFilter = > > NotifyFilters.LastAccess | NotifyFilters.LastWrite *| > > NotifyFilters.FileName | NotifyFilters.DirectoryName; > > * * * * * * * *filesystemwatcher.InternalBufferSize += 81920; Quote: > > * * * * * * * *filesystemwatcher.IncludeSubdirectories = true; > > * * * * * * * *filesystemwatcher.Created += new > > System.IO.FileSystemEventHandler(fsw_Changed); > > * * * * * * * *filesystemwatcher.Changed += new > > System.IO.FileSystemEventHandler(fsw_Changed); Quote: > > * * * * * * * *filesystemwatcher.EnableRaisingEvents = true; Quote: > > What could be the problem? Quote: > > Thanks, > > Yash |
My System Specs![]() |
| | #4 (permalink) |
| | Re: FileSystemWatcher not monitoring UNC folder On May 5, 12:04*pm, Yash Ganthe <yas...@xxxxxx> wrote: Quote: > 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 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/archi...uffersize.aspx. Any help? Damien |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| FileSystemWatcher Folder Rename | .NET General | |||
| Question about FileSystemWatcher? | PowerShell | |||
| WMP11 Not Monitoring Folder | Vista music pictures video | |||
| FileSystemWatcher not reporting files in folder moved to Recycle Bin? | .NET General | |||
| WMP 11 Folder Monitoring not working | Vista General | |||