How to know whether the file has been changed on same server or has transferred from another server in asp.net

82 views Asked by At

We have a webfarm scenario on which FileSystemWatcher is used to notify the changes occured on file.When a file is changed or created on one server it's gets noticed and the changes are transferred to another servers on webfarm.Again the transferred files on other servers raise the changed event and they are synced to the same server which create a redundant sync operation.We want to sync the changes only if the changes are on the same server not on the transferred changes from other servers.How could this be possible?

1

There are 1 answers

0
Mattias Åslund On

Have the servers monitor a temporary directory where uploaded files get stored. Let the FilesystemWatcher sync with the other servers at the same time it moves the file to the intended working directory. The sync sends the file to the other servers working directory of course, thus bypassing the other FilesystemWatchers. Voila!