FileSystemWatcher stops working on network share

  • Thread starter Thread starter Douglas Gallant
  • Start date Start date
D

Douglas Gallant

The symptoms I am seeing is that I have a Windows Service with a FSW
component working fine monitoring a UNC path. However, if there is a network
disconnect and then a reconnect, the FSW stops getting any events. I don't
know exactly how much of a network break is required for this to happen but
is easy to reproduce by pulling the network cable for a few moments. Is this
a known issue and hopefully it has an easy solution? BTW, the service is
running on a Win2K workstation.

Douglas Gallant
 
Known issue? Yes Think about it for a second like a phone call. When someone
hangs up on you, accidental or purposeful, can you restart the exact same
conversation without dialing again.

I would look at capturing when this event happens and restarting your FWS
process. In most cases, FWS services look at local drives, which is not a
problem. For a UNC path, I would definitely code in a backup to restart.

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

*************************************************
Think outside the box!
*************************************************
 
Not knowing the exact implementation of FSW I can accept that it stops
generating events after a network interuption. I also agree that something
to reestablish the FSW is needed. Can you provide a little code, link, etc.
on what event I need to capture? I can probably figure out how to force the
service to restart but I coulle of hints in that regard would be appreciated
as well.

Thanks for the info.
 
Douglas Gallant said:
Not knowing the exact implementation of FSW I can accept that it stops
generating events after a network interuption. I also agree that something
to reestablish the FSW is needed. Can you provide a little code, link, etc.
on what event I need to capture?

I am trying to do the same thing -- detect when FileSystemWatcher is
going to stop working on a network share when the network disconnects.
I find that FileSystemWatcher.Error gets called when the network
disconnects and ErrorEventArgs.GetException() returns a "The specified
network name is no longer available" exception. So I watch for those.

- M
 
Back
Top