Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7196465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:47:01+00:00 2026-05-28T20:47:01+00:00

I have a service that opens multiple watchers to watch multiple folders. After watching

  • 0

I have a service that opens multiple watchers to watch multiple folders. After watching folders for a certain amount of time I get the “The network bios command limit has been reached”.

As I read on here this is caused by having more long term requests than allowed.

I believe this occurs due to the below error handling code i have, which is triggered by the watchers error event. This starts a new instance of the watcher by calling the WatchFile method again. I believe this leaves the old now defunct watcher running and starts a new watcher but i am afraid stopping the watcher will either prevent it from starting it up again or will stop all instances based on the watcher.

Or am I wrong and is the error dependent on the amount of changes? This would cause 100 files to drop in at the same time to cause this error.

I was thinking of stopping and starting the service whenever I run in this error but this would not solve the problem itself but just hide it. Is there a better solution to it?

private static void watcherError(String directory, Boolean intray, ErrorEventArgs e, FileSystemWatcher watcher)
{
    Exception watchException = e.GetException();
    EventLog.WriteEntry("WhiteFileMover", String.Concat("error gedetecteerd, watcher werd herstart  -  ", watchException.Message), EventLogEntryType.Information);
    watcher = new FileSystemWatcher();
    while (!watcher.EnableRaisingEvents)
    {
        try
        {
            // This will throw an error at the
            // watcher.NotifyFilter line if it can't get the path.
            WatchFile(directory, intray);
        }
        catch(Exception exp)
        {
            // Sleep for a bit; otherwise, it takes a bit of
            // processor time
            EventLog.WriteEntry("WhiteFileMover", String.Concat("Failed to restart watcher, retrying in 5 seconds  -  ", exp.Message), EventLogEntryType.Warning);
            System.Threading.Thread.Sleep(5000);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T20:47:02+00:00Added an answer on May 28, 2026 at 8:47 pm

    Look at this line:

    watcher = new FileSystemWatcher();
    

    You passed in a FileSystemWatcher variable, but completely ignored the passed value. Instead, you created a new instance. Not only that, but you fail to correctly dispose the instance. My guess is that you have a bunch of old FileSystemWatcher objects hanging around waiting to be collected. Each of those will hold on to some real file system resources from the operating system. Over time, you run out of available file handles.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service that performs a database search. It accepts both GET
I have a Service that sends an Intent to my Activity every 0.1 seconds.
I have a service that use the tcp binding and this services allows to
I have a service that I would like it to become single instance, because
I have a service that is downloading a file. When the download is done,
I have .Net service that listens on single port over TCP protocol. Clients connect
I have a service that needs to update the registry every 5 minutes (counteract
I have a service that has a dependency on SQL server express (2005). Every
I have a service that contains a map: static Map cargosMap = ['1':'item1','2':'item 2','3':'item
I have a service that will return 0 or more sets of data. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.