简体   繁体   English

在 ASP.NET Core WebApi 中处理多个租户

[英]Handling multiple tenants in ASP.NET Core WebApi

I have developed .NET Core Web Api application and, a few different customers using the same app with different configurations.我已经开发了 .NET Core Web Api 应用程序和几个不同的客户使用具有不同配置的相同应用程序。 (App loads a config json file, listens a few ports, connects to the database.) For now, I'm using different servers for each customer to keep them separated.(Linode 1 Cpu, 1 GB Ram). (应用程序加载配置 json 文件,侦听几个端口,连接到数据库。)现在,我为每个客户使用不同的服务器来保持它们分开。(Linode 1 Cpu,1 GB Ram)。 It is very hard for me to publish updates, stopping starting service etc.我很难发布更新、停止启动服务等。

How do other devs do such things?其他开发者如何做这样的事情? Is there any way that I can merge the servers and manage it with single operation?有什么方法可以合并服务器并通过单一操作进行管理? OR what is the right way to do that?或者这样做的正确方法是什么?

There is a simple solution to handle this situation.有一个简单的解决方案来处理这种情况。 Host your web api on a single server and take a CustomerName or CustomerCode parameter in your web api, According to CustomerName or CustomerCode parameter route customer's api to appropriate method using switch case. Host your web api on a single server and take a CustomerName or CustomerCode parameter in your web api, According to CustomerName or CustomerCode parameter route customer's api to appropriate method using switch case.

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

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