Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
677 views
in Technique[技术] by (71.8m points)

file - C# FileSystemWatcher Serious Problem?

I have implemented a FileSystemWatcher for a folder which resides on a NetworkStorage Device (having no O.S.).

The scenario is, we have two machine says machine A and machine B. my application is having two buttons on my form Button1 and Button2. I have written code for renaming the Test.txt file.

Button1: renaming the file Test.txt to Test007.txt and Button2: renaming the file Test007.txt to Test.txt

And suppose I have run tis exe file from A and B simultaneously. Then I am able to rename file by pressing Button1 from Machine A and now If I am trying to rename the file from the another Machine B then it is giving an error

"System.ComponentModel.Win32Exception: The specified server can not perform the requested operation"

Anybody is having any Idea about it...please help us to find the solution. We are having proper rights for the folder.

Note : Code is also working for LAN Folder, So the code is perfect.it is just not working for NetworkStoreDevice.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

We built a product for a company where a Windows service running on a server was monitoring a folder and when files were added to this folder, the files were read, processed (in this case, created a barcode layout and printed on a barcode printer) and then deleted.

Everything worked perfectly for a number of customers with pretty good performance until we came across a customer where it only worked sometimes. There were especially problems when many files were added to the folder at once.

The problem were that the folder that we were watching was in a share on a samba filesystem and FileSystemWatcher does not work reliably on samba file system shares (Google for "FileSystemwatcher samba"). Since you are talking about a "NetworkStorage Device", I guess that you mean that it is a NAS, and NAS quite often use a Linux/Unix OS under the hoods and expose share using samba.

Our solution were to add a feature to our software so that it could be configured to use polling when needed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...