简体   繁体   中英

Write on a folder location on the web servers of a web farm

I have a web application hosted on a web farm. In the application there is a functionality where by user can write the files on a folder located on the virtual directory in the IIS like this:

var compressedFile = FileCompression.GetCompressedAndEncrypted(xml);
File.WriteAllBytes((filePath), compressedFile);

The issue here is that only the server that hooked to the client gets the updated files, but the requirement is to do this on both the servers of the farm simultaneously . There are two servers in the farm.

I want to achieve this programmatically. Please suggest...

You can do one of the following -

  1. store in database (easy to implement, but only good for small files)
  2. store in common location where all servers can access (like Windows Azure's Blob storage)
  3. use Microsoft Sync Framework to sync files (steep learning curve)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM