Activities of "nhontran"

Hi @liangshiwei, May I know from which version that Abp supports individual connection string for each module? I will try to take a look on it.

Thank you.

Hi @liangshiwei, thanks for your prompt reply!

I am still not quite clear about the solution. My understanding is the Abp Framework allows only 1 connection string when update the tenant, how does it know that this connection string is for the Main or Module?

Let's say I want to go with the option 1: having separate database for Module and share the same database for Main,

And I tried it before by setting the connection string pointing to the separate Module database (this database I created manually by executing the "dotnet ef database update" command)

Tenant connection string:

Module database

But when I tried to login to tenant, it prompted the error could not find the IdentityServer tables in the new database as I reported above.

Could you help me elaborate more on this solution?

Thank you.

Hi @liangshiwei, the database has been created, thanks.

However, it's not what I want, I want to have a separate database for the Module not for the Main.

can we have separate database for tenant and they share the same Main database?

or they can have separate database for both Module and Main:

Is it possible?

Thank you.

Hi @liangshiwei, I tried but it does not work, the OnPostAsync of MyConnectionStringsModal has never been called if I update the tenant connection string.

Hi @liangshiwei, it does not work, still got the error below:

[12:21:29 ERR] Connection ID "17798225737568747565", Request ID "8000002e-0002-f700-b63f-84710c7967bb": An unhandled exception was thrown by the application.
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'IdentityServerClients'.
   at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__164_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Volo.Abp.IdentityServer.Clients.ClientRepository.FindByCliendIdAsync(String clientId, Boolean includeDetails, CancellationToken cancellationToken)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Volo.Abp.IdentityServer.Clients.ClientStore.FindClientByIdAsync(String clientId)
   at IdentityServer4.Stores.ValidatingClientStore`1.FindClientByIdAsync(String clientId)
   at IdentityServer4.Stores.IClientStoreExtensions.FindEnabledClientByIdAsync(IClientStore store, String clientId)
   at IdentityServer4.Validation.AuthorizeRequestValidator.LoadClientAsync(ValidatedAuthorizeRequest request)
   at IdentityServer4.Validation.AuthorizeRequestValidator.ValidateAsync(NameValueCollection parameters, ClaimsPrincipal subject)
   at IdentityServer4.Services.OidcReturnUrlParser.ParseAsync(String returnUrl)
   at IdentityServer4.Services.ReturnUrlParser.ParseAsync(String returnUrl)
   at IdentityServer4.Services.DefaultIdentityServerInteractionService.GetAuthorizationContextAsync(String returnUrl)
   at Volo.Abp.Account.Web.Pages.Account.IdentityServerSupportedLoginModel.OnGetAsync()
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
   at IdentityServer4.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Builder.ApplicationBuilderAbpJwtTokenMiddlewareExtension.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
ClientConnectionId:3cc0c63b-c8bb-4a39-b808-af40264b7192
Error Number:208,State:1,Class:16
[12:21:29 INF] Request finished in 109.9776ms 500 

Hi, pls ignore the above question, I managed to resolve it, just one more clarification.

The "UnifiedDbContext" is located under Web.Unified project, does it mean we need to add Web.Unified project as reference?

Hi @liangshiwei, the "ConnectionStringsModal" could not be found in the IdentityServer project, do I need to add any extra dll?

Hi @liangshiwei, sorry for my late response.

Is your code must be put under *.Web.Unified? we are using Angular as UI, is there a fix for that?

Hmm.. just figured out that the "-t app-pro -v 3.3.2" has been changed to "-t app -v pro-3.3.2".

Please close the ticket, thanks.

  • ABP Framework version: v3.3.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hi, I got the license error when creating new project, below are the logs, could you please help me check?

C:\Users\Admin\source\repos\PB1>abp login nhontran
[12:37:36 INF] ABP CLI (https://abp.io)
[12:37:36 INF] Version 3.3.2 (Stable)
[12:37:39 WRN] ABP CLI has a newer stable version 5.1.1, please update to get the latest features and fixes.
[12:37:39 WRN]
[12:37:39 WRN] Update Command:
[12:37:39 WRN] dotnet tool update -g Volo.Abp.Cli
[12:37:39 WRN]
Password: [12:37:47 INF] Successfully logged in as 'nhontran'

C:\Users\Admin\source\repos\PB1>abp new TestingPB -csf -u angular -m none -t app-pro -v 3.3.2 --separate-identity-server
[12:37:52 INF] ABP CLI (https://abp.io)
[12:37:52 INF] Version 3.3.2 (Stable)
[12:37:54 WRN] ABP CLI has a newer stable version 5.1.1, please update to get the latest features and fixes.
[12:37:54 WRN]
[12:37:54 WRN] Update Command:
[12:37:54 WRN] dotnet tool update -g Volo.Abp.Cli
[12:37:54 WRN]
[12:37:54 INF] Creating your project...
[12:37:54 INF] Project name: TestingPB
[12:37:54 INF] Template: app-pro
[12:37:54 INF] Version: 3.3.2
[12:37:54 INF] UI Framework: Angular
[12:37:54 INF] Output folder: C:\Users\Admin\source\repos\PB1\TestingPB
[12:37:55 INF] Using cached template: app-pro, version: 3.3.2
[12:37:55 WRN] You do not have an active ABP Commercial license! If you have purchased it lately, you need to sign in again with the CLI command `abp login &lt;username&gt;`.
Volo.Abp.UserFriendlyException: You do not have an active ABP Commercial license! If you have purchased it lately, you need to sign in again with the CLI command `abp login &lt;username&gt;`.
   at Volo.Abp.Cli.ProjectBuilding.TemplateProjectBuilder.BuildAsync(ProjectBuildArgs args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectBuilding\TemplateProjectBuilder.cs:line 100
   at Volo.Abp.Cli.Commands.NewCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\NewCommand.cs:line 134
   at Volo.Abp.Cli.CliService.RunAsync(String[] args) in D:\ci\Jenkins\workspace\abp-framework-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\CliService.cs:line 59
[12:37:55 WRN] Code:
[12:37:55 WRN] Details:
Showing 71 to 80 of 195 entries
Made with ❤️ on ABP v9.1.0-rc.1. Updated on January 17, 2025, 14:13