'How do I save files to a server different from the server where my ASP.NET API application is on

So I am building a document management system where files are stored, retrieved and managed using ASP.Net Web API. I have achieved saving the files to the application server (that is the same server where the API is hosted) this can be on IIS, Azure App Service or any other hosting provider.

My challenge now is I wish to have a file server, that is a different server where only files will be stored while the API remains on another server. For instance, let's say my API is running on IIS on Server A (1.1.1.1), I don't want to store the files being uploaded to Server A, I have another Server B(1.1.1.2), which I can also configure IIS on, however, all I want to do with it is store the files sent to the API.

NB. Both servers are windows servers.

My most challenging questions now are:

  1. Is the scenario I described above possible or achievable? If Yes,
  2. How do I configure my ASP.Net API application to send files to Server B and also retrieve those files at a later time.
  3. What configurations do I need to do on IIS for both Server A and Server B.


Solution 1:[1]

Yes it's is doable.I had a similar challenge. I am a Node Js guy but I believe this will work for you as well.

You can achieve that by the use of Queuing with Redis or any other memory database.

  1. You will have to Configure publishers on the main server. In your case server A and then, configure Subscribers in server B

Here when you send a file to server A, Instead of saving it, You simply send it to server B through the corresponding publisher and server B will receive the task through the corresponding subscriber.

You can learn more Here

Also, This might be helful Link

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1