ABCD
ABCD

Reputation: 249

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...

Upvotes: 1

Views: 167

Answers (1)

Win
Win

Reputation: 62290

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)

Upvotes: 1

Related Questions