简体   繁体   English

如何将文件保存到与我的 ASP.NET API 应用程序所在的服务器不同的服务器

[英]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.因此,我正在构建一个文档管理系统,使用 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.我已经将文件保存到应用程序服务器(即托管 API 的同一台服务器),这可以在 IIS、Azure 应用服务或任何其他托管服务提供商上。

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.我现在面临的挑战是我希望拥有一个文件服务器,这是一个不同的服务器,其中仅存储文件,而 API 保留在另一台服务器上。 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.例如,假设我的 API 在服务器 A (1.1.1.1) 上的 IIS 上运行,我不想存储上传到服务器 A 的文件,我有另一个服务器 B(1.1.1.2),我也可以配置 IIS,但是,我想要做的只是存储发送到 API 的文件。

NB.注意。 Both servers are windows servers.两台服务器都是windows服务器。

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.如何配置我的 ASP.Net API 应用程序以将文件发送到服务器 B 并在以后检索这些文件。
  3. What configurations do I need to do on IIS for both Server A and Server B.我需要在 IIS 上为服务器 A 和服务器 B 进行哪些配置。

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.我是一个 Node Js 人,但我相信这也适用于你。

You can achieve that by the use of Queuing with Redis or any other memory database.您可以通过使用 Redis 或任何其他内存数据库的队列来实现这一点。

  1. You will have to Configure publishers on the main server.您必须在主服务器上配置发布者。 In your case server A and then, configure Subscribers in server B在您的情况下,服务器 A 然后在服务器 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.这里当你将文件发送到服务器 A 时,不是保存它,而是通过相应的发布者将其发送到服务器 B,服务器 B 将通过相应的订阅者接收任务。

You can learn more Here你可以在这里了解更多

Also, This might be helful Link此外,这可能是有帮助的链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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