Hello,
We are building a multi-tenant web application and will be having a separate database per tenant. when we add a new tenant from the owner login, it should send an email to a tenant with the link and login credentials. it automatically created a new database per tenant.
also need to know, how the tenant is identified or detected from the incoming URL using HOST HEADER and how the database connection changes dynamically? can you please explain this and refer us to the corresponding code files to check that?
Chirag
10 Answer(s)
-
0
Hi @InnodelTech,
You can modify TenantManager's CreateTenant method and include your email sending logic. You can check https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#determining-current-tenant to understand how the current tenant is determined.
You can also see the source code of tenant resolvers here
-
0
Hello,
We have checked the documentation. While doing development - we need the ability to determine tenants and it should auto-switch the database connection string based on the incoming URL.
lendinghub.com is main domian. Tenant is T1 - t1.lendinghub.com
and we also entered these entries into the host file to resolve with the local machine IP.
we need help here with the proper approach here to develop and test multi-tenancy. We are unable to do it with localhost. we don't want to switch tenants manually and check.
Please guide.
-
0
Hello,
I really need your immediate help with this.
We have tried our best to follow the guideline as per the link below with no luck in properly determining the tenant. https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#determining-current-tenant
In our case, we have created a domain
acme.lendinghub.com which points to 127.0.0.1 in etc\hosts file and pings correctly. We have created a website acme.lendinghub.com under IIS and are attaching the debugger to w3wp.exe process.
We have pointed the public project to acme.lendinghub.com so there is no logged-in user. The name field in abptenants table has "acme "as a value.
Lending_HubWebFrontEndModule.cs has this line
Configuration.Modules.AbpWebCommon().MultiTenancy.DomainFormat = "{0}.lendinghub.com";
//Enable this line to create a multi-tenant application. Configuration.MultiTenancy.IsEnabled = Lending_HubConsts.MultiTenancyEnabled;
Configuration.MultiTenancy.IgnoreFeatureCheckForHostUsers = true; // Added by Dipendra/Chirag as per document. Configuration.MultiTenancy.TenantIdResolveKey = "Abp-TenantId"; // Added by Dipendra/Chirag as per document.
We don't get the proper TenantId set or Tenant Name resolved.
-
0
Hi,
I assume your app uses a port number when you run it on your local computer. Because of that, I think you need to use that port number when setting MultiTenancy.DomainFormat as shown below;
Configuration.Modules.AbpWebCommon().MultiTenancy.DomainFormat = "{0}.lendinghub.com:44302";
Could you try this and see if it works ?
-
0
No, we are pointing to default port 80 in IIS. there is no port number. I confirm that is not the case,
-
0
Hi,
So, did you publish your app to your local IIS ?
-
0
Yes, we published it on the local IIS. To make it same as production environment.
-
0
Hi @InnodelTech
Thanks. If you use port numbers in the DomainFormat, then I tihnk you can debug this approach when you run the projetc using Visual Studio.
Are you able to see the login page when you visit t1.lendinghub.com or acme.lendinghub.com ? If so, please send an email to [email protected] and we will help you with a remote connection.
-
0
With site published under local IIS on port 80, the port number is not required in domain format I think. when visiting acme.lendinghub.com we see the public project page. not the login page. login page project is MVC project. We have planned it so that,
acme.lendinghub.com should go to the public page (marketing website) and acme.lendinghub.com/admin should go to tenant ("acme") login page. where tenant admin and other users will login.
We definitely need a remote session to fix this. I am sending email as suggested.
-
0
Hi,
Remote assistance is provided for this ticket.