Starts in:
2 DAYS
5 HRS
37 MIN
40 SEC
Starts in:
2 D
5 H
37 M
40 S
Open Closed

How do I add the CMS Kit Pro to the Microservice Template #4966


User avatar
0
chrislarabell created
  • ABP Framework version: v7.1.1
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes (microservices)
  • Exception message and stack trace: See full stack trace here

[10:59:53 ERR] An exception occurred while iterating over the results of a query for context type 'MyProjectRedacted.AdministrationService.EntityFrameworkCore.AdministrationServiceDbContext'. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'CmsBlogs'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__208_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- 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.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() ClientConnectionId:cbea5e32-1f31-4059-82eb-8a71ba88aedc Error Number:208,State:1,Class:16 Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'CmsBlogs'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__208_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- 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.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at Volo.CmsKit.Blogs.EfCoreBlogRepository.GetListAsync(String filter, String sorting, Int32 maxResultCount, Int32 skipCount, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.CmsKit.Blogs.BlogFeatureDataSeedContributor.SeedAsync(DataSeedContext context) at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) ClientConnectionId:cbea5e32-1f31-4059-82eb-8a71ba88aedc Error Number:208,State:1,Class:16 Unhandled exception. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'CmsBlogs'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__208_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- 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.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at Volo.CmsKit.Blogs.EfCoreBlogRepository.GetListAsync(String filter, String sorting, Int32 maxResultCount, Int32 skipCount, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.CmsKit.Blogs.BlogFeatureDataSeedContributor.SeedAsync(DataSeedContext context) at Volo.Abp.Data.DataSeeder.SeedAsync(DataSeedContext context) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at MyProjectRedacted.DbMigrator.MyProjectRedactedDbMigrationService.SeedDataAsync() in D:\MyProjectRedacted\shared\MyProjectRedacted.DbMigrator\MyProjectRedactedDbMigrationService.cs:line 130 at MyProjectRedacted.DbMigrator.MyProjectRedactedDbMigrationService.MigrateHostAsync(CancellationToken cancellationToken) in D:\MyProjectRedacted\shared\MyProjectRedacted.DbMigrator\MyProjectRedactedDbMigrationService.cs:line 57 at MyProjectRedacted.DbMigrator.MyProjectRedactedDbMigrationService.MigrateAsync(CancellationToken cancellationToken) in D:\MyProjectRedacted\shared\MyProjectRedacted.DbMigrator\MyProjectRedactedDbMigrationService.cs:line 48 at MyProjectRedacted.DbMigrator.DbMigratorHostedService.StartAsync(CancellationToken cancellationToken) in D:\MyProjectRedacted\shared\MyProjectRedacted.DbMigrator\DbMigratorHostedService.cs:line 37 at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token) at MyProjectRedacted.DbMigrator.Program.Main(String[] args) in D:\MyProjectRedacted\shared\MyProjectRedacted.DbMigrator\Program.cs:line 29 at MyProjectRedacted.DbMigrator.Program.<Main>(String[] args) ClientConnectionId:cbea5e32-1f31-4059-82eb-8a71ba88aedc Error Number:208,State:1,Class:16

  • Steps to reproduce the issue:" abp add-module Volo.CmsKit.Pro
  • ABP CLI 7.1.1 Installing module 'Volo.CmsKit.Pro' to the solution 'MySolutionRedacted' Installing 'Volo.CmsKit.Pro.Admin.HttpApi.Client' package to the project 'MyProjectRedacted.AdministrationService.HttpApi.Client'... Determining projects to restore... Writing C:\Users\Me\AppData\Local\Temp\tmpE02E.tmp info : X.509 certificate chain validation will use the default trust store selected by .NET. info : X.509 certificate chain validation will use the default trust store selected by .NET. info : Adding PackageReference for package 'Volo.CmsKit.Pro.Admin.HttpApi.Client' into project 'D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.HttpApi.Client\MyProjectRedacted.AdministrationService.HttpApi.Client.csproj'. info : Restoring packages for D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.HttpApi.Client\MyProjectRedacted.AdministrationService.HttpApi.Client.csproj... info : Package 'Volo.CmsKit.Pro.Admin.HttpApi.Client' is compatible with all the specified frameworks in project 'D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.HttpApi.Client\MyProjectRedacted.AdministrationService.HttpApi.Client.csproj'. info : PackageReference for package 'Volo.CmsKit.Pro.Admin.HttpApi.Client' version '7.1.1' added to file 'D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.HttpApi.Client\MyProjectRedacted.AdministrationService.HttpApi.Client.csproj'. info : Writing assets file to disk. Path: D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.HttpApi.Client\obj\project.assets.json log : Restored D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.HttpApi.Client\MyProjectRedacted.AdministrationService.HttpApi.Client.csproj (in 704 ms). Successfully installed. Installing 'Volo.CmsKit.Pro.Domain' package to the project 'MyProjectRedacted.AdministrationService.Domain'... Determining projects to restore... Writing C:\Users\Me\AppData\Local\Temp\tmpE781.tmp info : X.509 certificate chain validation will use the default trust store selected by .NET. info : X.509 certificate chain validation will use the default trust store selected by .NET. info : Adding PackageReference for package 'Volo.CmsKit.Pro.Domain' into project 'D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.Domain\MyProjectRedacted.AdministrationService.Domain.csproj'. info : Restoring packages for D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.Domain\MyProjectRedacted.AdministrationService.Domain.csproj... info : Package 'Volo.CmsKit.Pro.Domain' is compatible with all the specified frameworks in project 'D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.Domain\MyProjectRedacted.AdministrationService.Domain.csproj'. info : PackageReference for package 'Volo.CmsKit.Pro.Domain' version '7.1.1' added to file 'D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.Domain\MyProjectRedacted.AdministrationService.Domain.csproj'. info : Writing assets file to disk. Path: D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.Domain\obj\project.assets.json log : Restored D:\MyProjectRedacted\services\administration\src\MyProjectRedacted.AdministrationService.Domain\MyProjectRedacted.AdministrationService.Domain.csproj (in 591 ms). Successfully installed. Remaining output...

This this is the first method I tried and it did not work correctly either.


7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try to create AdministrationServiceGlobalFeatureConfigurator class in the MsApp.AdministrationService.Domain.Shared project

    using Volo.Abp.GlobalFeatures;
    using Volo.Abp.Threading;
    
    namespace MsApp.IdentityService;
    
    public static class AdministrationServiceGlobalFeatureConfigurator
    {
        private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
    
        public static void Configure()
        {
            OneTimeRunner.Run(() =>
            {
                GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit =>
                {
                    cmsKit.EnableAll();
                });
    
                GlobalFeatureManager.Instance.Modules.CmsKitPro(cmsKitPro =>
                {
                    cmsKitPro.EnableAll();
                });
            });
        }
    }
    

    Call the Configure method in the AdministrationServiceDomainSharedModule class

    Call the Configure method in the AdministrationServiceEfCoreEntityExtensionMappings class

    Run the dotnet ef migrations add AddCmsModule command to add migration files

  • User Avatar
    0
    chrislarabell created

    This works with also updating AdministrationServiceDbContext to include ICmsKitDbContext andICmsKitProDbContext and updating the AdministrationServiceEntityFrameworkCoreModule ConfigureServices method to replace the ICmsKitDbContext and ICmsKitProDbContext.

    In addition, I needed to update the gateways to include the new endpoints.

  • User Avatar
    0
    chrislarabell created

    FIXED (See update below.)

    Except I now have duplicate menu entries for a service I created.

    I followed this guide and created it prior to installing the CMS kit

    UPDATE: To fix this issue, I had to replace [DependsOn(typeof(CmsKitProWebModule))] with[DependsOn(typeof(CmsKitProAdminWebModule))]

  • User Avatar
    0
    chrislarabell created

    The final piece seems to be adding items to the PublicWeb project. I have created pages and menu items, but they do not show up on the PublicWeb site.

    I added the following Package Volo.CmsKit.Pro.Web and then added the following as a dependency typeof(CmsKitProPublicWebModule) in PublicWebModule.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    ok,

    Good to see the problem has been solved. I'm closing the question.

  • User Avatar
    1
    liangshiwei created
    Support Team Fullstack Developer

    I added the following Package Volo.CmsKit.Pro.Web and then added the following as a dependency typeof(CmsKitProPublicWebModule) in PublicWebModule.

    Maybe you need to enable the CMS feature for the Public web project.

  • User Avatar
    0
    chrislarabell created

    ok,

    Good to see the problem has been solved. I'm closing the question.

    The problem had not been solved! I asked how to add the CMS Kit to the microservices solution and I had to solve another problem.

    Once I did the configuration, I had to add typeof(CmsKitProHttpApiClientModule) to the DependsOn attribute.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06