Hi,
I have created a vanilla microservice template using ABP studio(v0.9.25) . However, encountered Internal Error 500
when new created tenant is trying to access file management module. Is there any extra code implementation need to be applied for my use case?
Remarks: The File management module is working if login as host.
Thanks.
8 Answer(s)
-
0
Hi, when you define separate connection strings per module, you should either write a connection string for all of them or also define a "Default" connection string, so the other modules can use it:
So, you should either pass the "Default" connection string, so other modules can use it, or you can define the file-management module connection string by following the documentation (and also separate db for your file management module): https://abp.io/docs/latest/framework/fundamentals/connection-strings
Regards.
-
0
Hi,
Thanks for your prompt reply.
I have tried to use
Default
connectionstring. Noticed that, theDefault
database missing some of the tables (E.g Identity related tables) and cause the tenant failed to login. I have even clickedApply database migrations
to confirm the migration run successfully. However, missing tables still not being applied. Could you please advise?Thanks.
-
0
Hi, sorry for the misunderstanding. Since you are using microservice template, when you selected "File Management" module as an optional module, ABP creates a separate service for the module, which is an independent service with independent database.
So, using Default connection string will not work.
Instead, you should add the following code to your saas service (only add for the file-management service, the other ones should already be added) - in the
ConfigureDatabase
method (inside the saasmodule class) -:Configure<AbpDbConnectionOptions>(options => { options.Databases.Configure("AdministrationService", database => { database.MappedConnections.Add(AbpPermissionManagementDbProperties.ConnectionStringName); database.MappedConnections.Add(AbpFeatureManagementDbProperties.ConnectionStringName); database.MappedConnections.Add(AbpSettingManagementDbProperties.ConnectionStringName); }); options.Databases.Configure("AuditLoggingService", database => { database.MappedConnections.Add(AbpAuditLoggingDbProperties.ConnectionStringName); }); options.Databases.Configure("LanguageService", database => { database.MappedConnections.Add(LanguageManagementDbProperties.ConnectionStringName); }); //only add the following: options.Databases.Configure("FileManagementService", database => { database.MappedConnections.Add("FileManagement"); }); });
Then, in the
appsettings.json
file of your Saas Service, add theFileManagementService
connection string:"ConnectionStrings": { "AdministrationService": "Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Issue9265_Administration; TrustServerCertificate=true; Connect Timeout=240;", "AuditLoggingService": "Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Issue9265_AuditLoggingService; TrustServerCertificate=true; Connect Timeout=240;", "LanguageService": "Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Issue9265_LanguageService; TrustServerCertificate=true; Connect Timeout=240;", "AbpBlobStoring": "Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Issue9265_BlobStoring; TrustServerCertificate=true; Connect Timeout=240;", "SaasService": "Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Issue9265_SaasService; TrustServerCertificate=true; Connect Timeout=240;", "FileManagementService": "Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Issue9265_FileManagementService; TrustServerCertificate=true; Connect Timeout=240;" },
After that, while configuring connection strings for your module, you should be able to see the FileManagementService in the list:
Here, you can define your connection string for the file-management service. Also, you can use the same approach if there is any additional service that you want to make database per tenant configuration.
Regards.
-
0
Hi,
Thanks for your clarification. Do i need to do the same for BlobStoring database as well since file-management module based on blob storing system? Does it mean in microservice template, we must use
module specific database
approach if make use of file-management service andDefault
database approach does not support this?Thanks.
-
0
Hi,
Thanks for your clarification. Do i need to do the same for BlobStoring database as well since file-management module based on blob storing system?
If you want you can also separate its database but you don't have to. (In your host database, it seems
Blobs
andAbpBlobContainers
tables are already there. So, no need to.)Does it mean in microservice template, we must use module specific database approach if make use of file-management service and Default database approach does not support this?
Actually, it's not module-specific but service-specific, yes. These are separate and independent services and, therefore, have independent databases. But not only services have a single module; for example, the administration service composes multiple services, and its database contains multiple tables from different modules.
The
default
connection string is used as a fallback value if you don't define a connection string for a specific microservice database and it's also supported in microservices. (https://abp.io/docs/latest/solution-templates/microservice/database-configurations#the-connection-string-management-modal)Regards.
-
0
Hi,
Thanks for your detailed explanation.
The default connection string is used as a fallback value if you don't define a connection string for a specific microservice database and it's also supported in microservices. (https://abp.io/docs/latest/solution-templates/microservice/database-configurations#the-connection-string-management-modal)
Currently, I am trying to setup a new tenant with
Default connection string
andUse module specific database connection string
for file-management service and Identity service(Refers to screenshot below).Based on my understanding, the
Default
database will include tables from other microservices(e.g., administration, audit logging), except for those services that are explicitly configured toUse module specific database connection string
. After i clicked the Save button, the EF migration was triggered. Noticed that, some tables from other services(administration, auditlog) are missing fromDefault
database. As i expected, all tables from services not using specific connection string should be included in theDefault
database. Did I miss any configuration or is this the expected behavior? I would appreciate your help in clarifying this for me.Thanks.
-
0
As i expected, all tables from services not using specific connection string should be included in the Default database. Did I miss any configuration or is this the expected behavior?
Hi, normally in a layered architecture, it's like you expected. But in the microservice architecture, since we have services for each module, we already define connection strings for them, and they point to the related service. So, this is the reason, when you use the
Default
connection string there are some missing tables. (If you check the ConfigureDatabases method of each service, you can see that)So, in your case, you should either define each service connection string per tenant or use the shared database option.
-
0
Hi,
Thanks again for your help. Everything is clear now.