FileSystemWatcher stops working on network share

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
 
C

Cowboy \(Gregory A. Beamer\)

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!
*************************************************
 
D

Douglas Gallant

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.
 
M

Michael Yang

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
 

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