I have tried asking this question on Stackoverflow, considering it is related to programming, but it appears it is more of a server issue than anything.

I have .Net framework 3.5 based application on Windows Server 2008, which is monitoring 22 folders on a remote server/network path. I am using FileSystemWatcher and every now and then I will get an exception in the log.

System.ComponentModel.Win32Exception: The network BIOS command limit has been reached.

I have tried following the article KB-810886, but since my server is Windows Server 2008 I don't have registry keys for MaxCmds, MaxMpxCT etc. I have already looked at related questions on Stackoverflow like this one and this one, but none of them seems to have resolved the issue.

My question is:

Is there a way to increase the limit of MaxCMDs in Windows Server 2008 ? and Do I have to increase the limit on my server hosting Windows Service, or should I increase the limit on the File Server (which has all the folders).

Here are coding things I have tried in my code:

I have tried increasing the InternalBufferSize to MAX (64K) but it doesn't have any effect on the exception.

I have defined it like:

At Class level:

FileSystemWatcher fsw;

In Initialization method

fsw = new FileSystemWatcher("FolderUNC");
fsw.IncludeSubdirectories = false;
//m_fsw.InternalBufferSize = 65536; -- Commented out to default 8K
fsw.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.Size;
fsw.Renamed += new RenamedEventHandler(OnChanged);
fsw.Deleted += new FileSystemEventHandler(OnChanged);
fsw.Changed += new FileSystemEventHandler(OnChanged);
fsw.Created += new FileSystemEventHandler(OnChanged);
fsw.Error += new ErrorEventHandler(OnFileSystemWatcherError);
fsw.EnableRaisingEvents = true;   

I am also making sure that I dispose the FileSystemWatcher object on Error or on stopping the service. Like

if (fsw != null)

Any help or guidance in resolving the issue is appreciated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.