Open Closed

MicroService-Pro add CmsKit-Pro, Menu is missing #5930


User avatar
0
niall created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

  • ABP Framework version: v7.3.2
  • UI Type: MVC
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
[14:28:42 INF] Request starting HTTP/1.1 GET https://localhost:44360/api/cms-kit-public/pages?api-version=1.0 - 0
[14:28:42 INF] Executing endpoint 'Volo.CmsKit.Public.Pages.PagesPublicController.FindDefaultHomePageAsync (Volo.CmsKit.Public.HttpApi)'
[14:28:42 INF] Route matched with {area = "cms-kit", action = "FindDefaultHomePage", controller = "PagesPublic"}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.CmsKit.Contents.PageDto] FindDefaultHomePageAsync() on controller Volo.CmsKit.Public.Pages.PagesPublicController (Volo.CmsKit.Public.HttpApi).
[14:28:43 ERR] ---------- RemoteServiceErrorInfo ----------
{
  "code": null,
  "message": "An internal error occurred during your request!",
  "details": null,
  "data": {
    "ActivatorChain": "Volo.CmsKit.EntityFrameworkCore.CmsKitDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.CmsKit.EntityFrameworkCore.CmsKitDbContext, Volo.CmsKit.EntityFrameworkCore, Version=7.3.2.0, Culture=neutral, PublicKeyToken=null]]"
  },
  "validationErrors": null
}

[14:28:43 ERR] An exception was thrown while activating Volo.CmsKit.EntityFrameworkCore.CmsKitDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.CmsKit.EntityFrameworkCore.CmsKitDbContext, Volo.CmsKit.EntityFrameworkCore, Version=7.3.2.0, Culture=neutral, PublicKeyToken=null]].
Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.CmsKit.EntityFrameworkCore.CmsKitDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.CmsKit.EntityFrameworkCore.CmsKitDbContext, Volo.CmsKit.EntityFrameworkCore, Version=7.3.2.0, Culture=neutral, PublicKeyToken=null]].
 ---> Volo.Abp.AbpException: No configuration found for Microsoft.EntityFrameworkCore.DbContext, Microsoft.EntityFrameworkCore, Version=7.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60! Use services.Configure<AbpDbContextOptions>(...) to configure it.
   at Volo.Abp.EntityFrameworkCore.DependencyInjection.DbContextOptionsFactory.Configure[TDbContext](AbpDbContextOptions options, AbpDbContextConfigurationContext`1 context)
   at Volo.Abp.EntityFrameworkCore.DependencyInjection.DbContextOptionsFactory.Create[TDbContext](IServiceProvider serviceProvider)
   at Autofac.Extensions.DependencyInjection.AutofacRegistration.&lt;&gt;c__DisplayClass3_0.&lt;Register&gt;b__0(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.&lt;ConfigurePipeline&gt;b__2_0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
   at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1.CreateDbContextAsync(IUnitOfWork unitOfWork)
   at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1.CreateDbContextAsync(IUnitOfWork unitOfWork, String connectionStringName, String connectionString)
   at Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider`1.GetDbContextAsync()
   at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository`2.GetDbSetAsync()
   at Volo.Abp.Domain.Repositories.EntityFrameworkCore.EfCoreRepository`2.GetListAsync(Expression`1 predicate, 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.CmsKit.Pages.PageManager.GetHomePageAsync()
   at Volo.CmsKit.Public.Pages.PagePublicAppService.FindDefaultHomePageAsync()
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Features.FeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.GlobalFeatures.GlobalFeatureInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Auditing.AuditingInterceptor.ProceedByLoggingAsync(IAbpMethodInvocation invocation, AbpAuditingOptions options, IAuditingHelper auditingHelper, IAuditLogScope auditLogScope)
   at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   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 lambda_method1630(Closure, Object)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeInnerFilterAsync&gt;g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextExceptionFilterAsync&gt;g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
[14:28:43 ERR] ---------- Exception Data ----------
ActivatorChain = Volo.CmsKit.EntityFrameworkCore.CmsKitDbContext -> λ:Microsoft.EntityFrameworkCore.DbContextOptions`1[[Volo.CmsKit.EntityFrameworkCore.CmsKitDbContext, Volo.CmsKit.EntityFrameworkCore, Version=7.3.2.0, Culture=neutral, PublicKeyToken=null]]
  • Steps to reproduce the issue:

I use the MicroService-pro template created a solution.

Add CmsKit-Pro Module to product service use abp suite.

Enabled the feature of CmsKit pro in Domain.Shared

  GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit =>
            {
                cmsKit.EnableAll();
            });

            GlobalFeatureManager.Instance.Modules.CmsKitPro(cmsKitPro =>
            {
                cmsKitPro.EnableAll();
            });

I run the solution, throw exception.

ProductServiceDbContext.cs

[ConnectionStringName(ProductServiceDbProperties.ConnectionStringName)]
public class ProductServiceDbContext : AbpDbContext<ProductServiceDbContext>
{
    public DbSet<Product> Products { get; set; }

    public ProductServiceDbContext(DbContextOptions<ProductServiceDbContext> options)
        : base(options)
    {

    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        builder.ConfigureProductService();
        builder.ConfigureCmsKitPro();
        builder.ConfigureCmsKit();
    }
}

ProductServiceDbContextFactory.cs

public class ProductServiceDbContextFactory : IDesignTimeDbContextFactory<ProductServiceDbContext>
{
    private readonly string _connectionString;

    /* This constructor is used when you use EF Core tooling (e.g. Update-Database) */
    public ProductServiceDbContextFactory()
    {
        _connectionString = GetConnectionStringFromConfiguration();
    }

    public ProductServiceDbContext CreateDbContext(string[] args)
    {
        ProductServiceEfCoreEntityExtensionMappings.Configure();

        var builder = new DbContextOptionsBuilder<ProductServiceDbContext>()
            .UseMySql(_connectionString, MySqlServerVersion.LatestSupportedServerVersion, b =>
            {
                b.MigrationsHistoryTable("__ProductService_Migrations");
            });

        return new ProductServiceDbContext(builder.Options);
    }

    private static string GetConnectionStringFromConfiguration()
    {
        return BuildConfiguration()
            .GetConnectionString(ProductServiceDbProperties.ConnectionStringName);
    }

    private static IConfigurationRoot BuildConfiguration()
    {
        var builder = new ConfigurationBuilder()
            .SetBasePath(
                Path.Combine(
                    Directory.GetCurrentDirectory(),
                    $"..{Path.DirectorySeparatorChar}XTC.BaaSo.ProductService.HttpApi.Host"
                )
            )
            .AddJsonFile("appsettings.json", optional: false);

        return builder.Build();
    }
}

ProductServiceEntityFrameworkCoreModule.cs

[DependsOn(
    typeof(AbpEntityFrameworkCoreMySQLModule),
    typeof(AbpEntityFrameworkCoreModule),
    typeof(ProductServiceDomainModule)
)]
[DependsOn(typeof(CmsKitProEntityFrameworkCoreModule))]
public class ProductServiceEntityFrameworkCoreModule : AbpModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        ProductServiceEfCoreEntityExtensionMappings.Configure();
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.AddAbpDbContext<ProductServiceDbContext>(options =>
        {
            /* Remove "includeAllEntities: true" to create
             * default repositories only for aggregate roots */
            options.AddDefaultRepositories(includeAllEntities: true);
            options.AddRepository<Product, EfCoreProductRepository>();
        });

        context.Services.Configure<AbpDbContextOptions>(options => { });

        Configure<AbpDbContextOptions>(options =>
        {
            options.Configure<ProductServiceDbContext>(c =>
            {
                c.UseMySQL(b =>
                {
                    b.MigrationsHistoryTable("__ProductService_Migrations");
                });
            });
        });
    }
}

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

    Hi,

    You can try:

    [ConnectionStringName(ProductServiceDbProperties.ConnectionStringName)]
    public class ProductServiceDbContext : AbpDbContext<ProductServiceDbContext>, ICmsKitProDbContext, ICmsKitDbContext
    {
        public DbSet<Product> Products { get; set; }
        
        .......
    
        public ProductServiceDbContext(DbContextOptions<ProductServiceDbContext> options)
            : base(options)
        {
    
        }
    
        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
    
            builder.ConfigureProductService();
            builder.ConfigureCmsKitPro();
            builder.ConfigureCmsKit();
        }
    }
    
    [DependsOn(
        typeof(AbpEntityFrameworkCoreMySQLModule),
        typeof(AbpEntityFrameworkCoreModule),
        typeof(ProductServiceDomainModule)
    )]
    [DependsOn(typeof(CmsKitProEntityFrameworkCoreModule))]
    public class ProductServiceEntityFrameworkCoreModule : AbpModule
    {
        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            ProductServiceEfCoreEntityExtensionMappings.Configure();
        }
    
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.AddAbpDbContext<ProductServiceDbContext>(options =>
            {
                options.ReplaceDbContext<ICmsKitDbContext>(); // add this line
                options.ReplaceDbContext<ICmsKitProDbContext>(); // add this line        
    
                /* Remove "includeAllEntities: true" to create
                 * default repositories only for aggregate roots */
                options.AddDefaultRepositories(includeAllEntities: true);
                options.AddRepository<Product, EfCoreProductRepository>();
            });
    
            context.Services.Configure<AbpDbContextOptions>(options => { });
    
            Configure<AbpDbContextOptions>(options =>
            {
                options.Configure<ProductServiceDbContext>(c =>
                {
                    c.UseMySQL(b =>
                    {
                        b.MigrationsHistoryTable("__ProductService_Migrations");
                    });
                });
            });
        }
    }
    
  • User Avatar
    0
    niall created

    Hi, liangshiwei

    1. add codes follow you
    2. run dotnet ef migrations add CMSKit at ProductService.EntityFrameworkCore
    3. run DbMigrator, throw exception

    [12:16:23 ERR] An exception occurred while iterating over the results of a query for context type 'XTC.BaaSo.ProductService.EntityFrameworkCore.ProductServiceDbContext'. MySqlConnector.MySqlException (0x80004005): Table 'BaaSo_Product.CmsBlogs' doesn't exist at MySqlConnector.Core.ServerSession.ReceiveReplyAsyncAwaited(ValueTask`1 task) in

  • User Avatar
    0
    niall created

    I saw the code of migrations, but not found nothing about CmsBlogs

    using System;
    using Microsoft.EntityFrameworkCore.Migrations;
    
    #nullable disable
    
    namespace XTC.BaaSo.ProductService.Migrations
    {
        /// <inheritdoc />
        public partial class CMSKit : Migration
        {
            /// <inheritdoc />
            protected override void Up(MigrationBuilder migrationBuilder)
            {
                migrationBuilder.CreateTable(
                    name: "NewsletterRecords",
                    columns: table => new
                    {
    ...
                    },
                    constraints: table =>
                    {
    ...
                    })
                    .Annotation("MySql:CharSet", "utf8mb4");
    
                migrationBuilder.CreateTable(
                    name: "Polls",
                    columns: table => new
                    {
    ...
                    },
                    constraints: table =>
                    {
    ...
                    })
                    .Annotation("MySql:CharSet", "utf8mb4");
    
                migrationBuilder.CreateTable(
                    name: "PollUserVotes",
                    columns: table => new
                    {
    ...
                    },
                    constraints: table =>
                    {
    ...
                    })
                    .Annotation("MySql:CharSet", "utf8mb4");
    
                migrationBuilder.CreateTable(
                    name: "ShortenedUrls",
                    columns: table => new
                    {
    ...
                    },
                    constraints: table =>
                    {
    ...
                    })
                    .Annotation("MySql:CharSet", "utf8mb4");
    
                migrationBuilder.CreateTable(
                    name: "NewsletterPreferences",
                    columns: table => new
                    {
    ...
                    },
                    constraints: table =>
                    {
    ...
                    })
                    .Annotation("MySql:CharSet", "utf8mb4");
    
                migrationBuilder.CreateTable(
                    name: "PollOptions",
                    columns: table => new
                    {
    ...
                    },
                    constraints: table =>
                    {
    ...
                    })
                    .Annotation("MySql:CharSet", "utf8mb4");
    
                migrationBuilder.CreateIndex(
                    name: "IX_NewsletterPreferences_NewsletterRecordId",
                    table: "NewsletterPreferences",
                    column: "NewsletterRecordId");
    
                migrationBuilder.CreateIndex(
                    name: "IX_PollOptions_PollId",
                    table: "PollOptions",
                    column: "PollId");
            }
    
            /// <inheritdoc />
            protected override void Down(MigrationBuilder migrationBuilder)
            {
                migrationBuilder.DropTable(
                    name: "NewsletterPreferences");
    
                migrationBuilder.DropTable(
                    name: "PollOptions");
    
                migrationBuilder.DropTable(
                    name: "PollUserVotes");
    
                migrationBuilder.DropTable(
                    name: "ShortenedUrls");
    
                migrationBuilder.DropTable(
                    name: "NewsletterRecords");
    
                migrationBuilder.DropTable(
                    name: "Polls");
            }
        }
    }
    
    
  • User Avatar
    0
    niall created

    and this is my code

    ProductServiceDbContext .cs

    using Microsoft.EntityFrameworkCore;
    using XTC.BaaSo.ProductService.Products;
    using Volo.Abp.Data;
    using Volo.Abp.EntityFrameworkCore;
    using Volo.CmsKit.EntityFrameworkCore;
    using Volo.CmsKit.Newsletters;
    using Volo.CmsKit.UrlShorting;
    using Volo.CmsKit.Polls;
    using Volo.CmsKit.Comments;
    using Volo.CmsKit.Users;
    using Volo.CmsKit.Reactions;
    using Volo.CmsKit.Ratings;
    using Volo.CmsKit.Tags;
    using Volo.CmsKit.Pages;
    using Volo.CmsKit.Blogs;
    using Volo.CmsKit.MediaDescriptors;
    using Volo.CmsKit.Menus;
    using Volo.CmsKit.GlobalResources;
    
    namespace XTC.BaaSo.ProductService.EntityFrameworkCore;
    
    [ConnectionStringName(ProductServiceDbProperties.ConnectionStringName)]
    public class ProductServiceDbContext : AbpDbContext<ProductServiceDbContext>, ICmsKitProDbContext, ICmsKitDbContext
    {
        public DbSet<Product> Products { get; set; }
        public DbSet<NewsletterRecord> NewsletterRecords { get; set; }
        public DbSet<NewsletterPreference> NewsletterPreferences { get; set; }
        public DbSet<ShortenedUrl> ShortenedUrls { get; set; }
        public DbSet<Poll> Polls { get; set; }
        public DbSet<PollUserVote> PollUserVotes { get; set; }
        public DbSet<PollOption> PollOptions { get; set; }
    
        public DbSet<Comment> Comments { get; set; }
    
        public DbSet<CmsUser> User { get; set; }
    
        public DbSet<UserReaction> Reactions { get; set; }
    
        public DbSet<Rating> Ratings { get; set; }
    
        public DbSet<Tag> Tags { get; set; }
    
        public DbSet<EntityTag> EntityTags { get; set; }
    
        public DbSet<Page> Pages { get; set; }
    
        public DbSet<Blog> Blogs { get; set; }
    
        public DbSet<BlogPost> BlogPosts { get; set; }
    
        public DbSet<BlogFeature> BlogFeatures { get; set; }
    
        public DbSet<MediaDescriptor> MediaDescriptors { get; set; }
    
        public DbSet<MenuItem> MenuItems { get; set; }
    
        public DbSet<GlobalResource> GlobalResources { get; set; }
    
        public ProductServiceDbContext(DbContextOptions<ProductServiceDbContext> options)
            : base(options)
        {
    
        }
    
        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
    
            builder.ConfigureProductService();
            builder.ConfigureCmsKitPro();
            builder.ConfigureCmsKit();
        }
    }
    
    

    ProductServiceEntityFrameworkCoreModule.cs

    using Microsoft.Extensions.DependencyInjection;
    using XTC.BaaSo.ProductService.Products;
    using Volo.Abp.EntityFrameworkCore;
    using Volo.Abp.EntityFrameworkCore.MySQL;
    using Volo.Abp.Modularity;
    using Volo.CmsKit.EntityFrameworkCore;
    
    namespace XTC.BaaSo.ProductService.EntityFrameworkCore;
    
    [DependsOn(
        typeof(AbpEntityFrameworkCoreMySQLModule),
        typeof(AbpEntityFrameworkCoreModule),
        typeof(ProductServiceDomainModule)
    )]
    [DependsOn(typeof(CmsKitProEntityFrameworkCoreModule))]
    public class ProductServiceEntityFrameworkCoreModule : AbpModule
    {
        public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            ProductServiceEfCoreEntityExtensionMappings.Configure();
        }
    
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.AddAbpDbContext<ProductServiceDbContext>(options =>
            {
                options.ReplaceDbContext<ICmsKitDbContext>(); 
                options.ReplaceDbContext<ICmsKitProDbContext>();
                /* Remove "includeAllEntities: true" to create
                 * default repositories only for aggregate roots */
                options.AddDefaultRepositories(includeAllEntities: true);
                options.AddRepository<Product, EfCoreProductRepository>();
            });
    
            Configure<AbpDbContextOptions>(options =>
            {
                options.Configure<ProductServiceDbContext>(c =>
                {
                    c.UseMySQL(b =>
                    {
                        b.MigrationsHistoryTable("__ProductService_Migrations");
                    });
                });
            });
        }
    }
    
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you share a simple project to reproduce the problem with me? shiwei.liang@volosoft.com I will check it. thanks.

  • User Avatar
    0
    niall created

    OK, I sended.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Please move GlobalFeatureManager.Instance.Modules.Cms... to ProductServiceGlobalFeatureConfigurator class

  • User Avatar
    0
    niall created

    Fine, the tables about CmsKit is appears in database, but permissions of role about CmsKit not found , so i can't see cmskit at sidemenu.

    Features of cmskit is opend.

    I checked the database, found some values of cmskit in table about permission.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi

    I will check it.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try add the Volo.CmsKit.Pro.Domain.Shared package to XTC.BaaSo.AdministrationService.Domain.Shared project and configure the global features.

  • User Avatar
    0
    niall created

    Cool, resolved !

    But is it possible not to modify the AdministrationService? In my product architecture, CmsKit will be offered as a separate MicroService like as ProductService. AdministrationService will do not reference other modules. If possible, I would like to resolve it in the ProductService.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Unfortunately, you have to add it. The CMS module is kind of special, Its permissions need to check the global features. And AdministrationService is responsible for permission checking, the global feature must be enabled for it.

    The Volo.CmsKit.Pro.Domain.Shared is a shared project, it's okay to share between different services.

  • User Avatar
    0
    niall created

    Well, I will include all the pre-built modules in AdministrationService. So, which modules need do this at https://commercial.abp.io/modules?

    I have another question, how to include cms in publicweb? Is there documentation for this?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Well, I will include all the pre-built modules in AdministrationService. So, which modules need do this at https://commercial.abp.io/modules

    Currently only Cms-kit module.

    I have another question, how to include cms in publicweb? Is there documentation for this?

    You can add the Volo.CmsKit.Pro.Public.Web and Volo.CmsKit.Pro.Public.HttpApi.Client package to the public web project. (also add the module dependencies)

    Update the public web gateway configuration to forward requests to the product service.

  • User Avatar
    0
    niall created

    I closed the features of CmsKit, system crashed. I must delete all databases and migrate again.

    Is there a way to reopen these features about CmsKit? Or not allowing users to close these?

    CmsKitService

    [18:16:51 INF] Route matched with {area = "cms-kit", action = "FindBySlug", controller = "PagesPublic"}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.CmsKit.Contents.PageDto] FindBySlugAsync(System.String) on controller Volo.CmsKit.Public.Pages.PagesPublicController (Volo.CmsKit.Public.HttpApi).
    [18:16:51 WRN] ---------- RemoteServiceErrorInfo ----------
    {
      "code": "Volo.Feature:010003",
      "message": "Required features are not enabled. At least one of these features must be enabled: CmsKit.PageEnable",
      "details": null,
      "data": {
        "FeatureNames": "CmsKit.PageEnable"
      },
      "validationErrors": null
    }
    
    [18:16:51 WRN] Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown.
    

    Web

    [18:16:50 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy
    [18:16:50 INF] Executing handler method XTC.BaaSo.Web.Pages.IndexModel.OnGet - ModelState is Valid
    [18:16:50 INF] Executed handler method OnGet, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult.
    [18:16:50 ERR] An exception was thrown while deserializing the token.
    Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted.
     ---> System.Security.Cryptography.CryptographicException: The key {02049ad8-7d73-44b0-8795-e7b42d02cee1} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning
       at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
       at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
       at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken)
       --- End of inner exception stack trace ---
       at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken)
       at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.GetCookieTokenDoesNotThrow(HttpContext httpContext)
    [18:16:50 INF] Bundling __bundles/LeptonX.Global.9325FB768F9C0093DC4664395D730921.css (17 files)
    [18:16:50 INF]   > Minified /libs/abp/core/abp.css (1331 bytes -> 868 bytes)
    [18:16:50 INF]   > Minified /libs/@fortawesome/fontawesome-free/css/all.css (73577 bytes -> 53572 bytes)
    [18:16:50 INF]   > Minified /libs/@fortawesome/fontawesome-free/css/v4-shims.css (41312 bytes -> 33344 bytes)
    [18:16:50 INF]   > Minified /libs/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css (54850 bytes -> 43189 bytes)
    [18:16:50 INF]   > Minified /libs/datatables.net-bs5/css/dataTables.bootstrap5.css (13491 bytes -> 11874 bytes)
    [18:16:50 INF]   > Minified /libs/bootstrap-daterangepicker/daterangepicker.css (8069 bytes -> 6378 bytes)
    [18:16:50 INF]   > Minified /libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css (266 bytes -> 214 bytes)
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/libs/bootstrap-icons/font/bootstrap-icons.css (74827 bytes -> 57860 bytes)
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/css/js-bundle.css (34690 bytes -> 30518 bytes)
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/css/layout-bundle.css (251958 bytes -> 247161 bytes)
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/css/abp-bundle.css (3870 bytes -> 3025 bytes)
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/css/font-bundle.css (117 bytes -> 116 bytes)
    [18:16:50 INF]   > Minified /global-styles.css (348 bytes -> 279 bytes)
    [18:16:50 INF] Bundled __bundles/LeptonX.Global.9325FB768F9C0093DC4664395D730921.css (542070 bytes)
    [18:16:50 INF] Start processing HTTP request GET https://localhost:44380/api/abp/application-configuration?IncludeLocalizationResources=False&api-version=1.0
    [18:16:50 INF] Sending HTTP request GET https://localhost:44380/api/abp/application-configuration?IncludeLocalizationResources=False&api-version=1.0
    [18:16:50 INF] Received HTTP response headers after 64.8629ms - 200
    [18:16:50 INF] End processing HTTP request after 65.0538ms - 200
    [18:16:50 INF] Start processing HTTP request GET https://localhost:44380/api/abp/application-localization?CultureName=en&OnlyDynamics=True&api-version=1.0
    [18:16:50 INF] Sending HTTP request GET https://localhost:44380/api/abp/application-localization?CultureName=en&OnlyDynamics=True&api-version=1.0
    [18:16:50 INF] Received HTTP response headers after 42.4769ms - 200
    [18:16:50 INF] End processing HTTP request after 42.6202ms - 200
    [18:16:50 INF] Start processing HTTP request GET https://localhost:44380/api/cms-kit-public/menu-items?api-version=1.0
    [18:16:50 INF] Sending HTTP request GET https://localhost:44380/api/cms-kit-public/menu-items?api-version=1.0
    [18:16:51 INF] Received HTTP response headers after 897.3606ms - 403
    [18:16:51 INF] End processing HTTP request after 897.6537ms - 403
    [18:16:51 INF] Executed page /Index in 1549.3604ms
    [18:16:51 INF] Executed endpoint '/Index'
    [18:16:51 ERR] An unhandled exception has occurred while executing the request.
    Volo.Abp.Http.Client.AbpRemoteCallException: Forbidden
       at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.ThrowExceptionForResponseAsync(HttpResponseMessage response)
       at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync(ClientProxyRequestContext requestContext)
       at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](ClientProxyRequestContext requestContext)
       at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments)
       at Volo.CmsKit.Public.Menus.ClientProxies.MenuItemPublicClientProxy.GetListAsync()
       at Volo.CmsKit.Public.Web.Menus.CmsKitPublicMenuContributor.ConfigureMainMenuAsync(MenuConfigurationContext context)
       at Volo.CmsKit.Public.Web.Menus.CmsKitPublicMenuContributor.ConfigureMenuAsync(MenuConfigurationContext context)
       at Volo.Abp.UI.Navigation.MenuManager.GetInternalAsync(String name)
       at Volo.Abp.UI.Navigation.MenuManager.GetAsync(String[] menuNames)
       at Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Navigation.MenuViewModelProvider.GetMenuViewModelAsync()
       at Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Themes.LeptonX.Components.SideMenu.MainMenu.MainMenuViewComponent.InvokeAsync()
       at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsyncCore(ObjectMethodExecutor executor, Object component, ViewComponentContext context)
       at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
       at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
       at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeCoreAsync(ViewComponentDescriptor descriptor, Object arguments)
       at Volo.Abp.AspNetCore.Mvc.UI.Widgets.AbpViewComponentHelper.InvokeAsync(Type componentType, Object arguments)
       at V1baMV6YmQplw0X98PH.UPIMWT6TrLmYa5A0bLn.ExecuteAsync()
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData)
       at s9pw74fNUuN4Eq9OcZh.SMIS7FfDqF8eAAIYmQI.&lt;&gt;c__DisplayClass21_0.zesArhS6o8NoyemU221.MoveNext()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
       at s9pw74fNUuN4Eq9OcZh.SMIS7FfDqF8eAAIYmQI.ExecuteAsync()
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
       at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextResultFilterAsync&gt;g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeResultFilters&gt;g__Awaited|28_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextResourceFilter&gt;g__Awaited|25_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.&lt;InvokeFilterPipelineAsync&gt;g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeAsync&gt;g__Logged|17_1(ResourceInvoker invoker)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeAsync&gt;g__Logged|17_1(ResourceInvoker invoker)
       at Microsoft.AspNetCore.Routing.EndpointMiddleware.&lt;Invoke&gt;g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
       at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
       at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.&lt;&gt;c__DisplayClass6_1.&lt;&lt;UseMiddlewareInterface&gt;b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.&lt;&gt;c__DisplayClass6_1.&lt;&lt;UseMiddlewareInterface&gt;b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
       at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.&lt;&gt;c__DisplayClass6_1.&lt;&lt;UseMiddlewareInterface&gt;b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.&lt;&gt;c__DisplayClass6_1.&lt;&lt;UseMiddlewareInterface&gt;b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.&lt;Invoke&gt;g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
    [18:16:51 INF] Executing endpoint '/Public/CmsKit/Pages/Index'
    [18:16:51 INF] Route matched with {page = "/Public/CmsKit/Pages/Index", action = "", controller = "", area = ""}. Executing page /Public/CmsKit/Pages/Index
    [18:16:51 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy
    [18:16:51 INF] Executing handler method Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Pages.IndexModel.OnGetAsync - ModelState is Valid
    [18:16:51 INF] Start processing HTTP request GET https://localhost:44380/api/cms-kit-public/pages/Error?api-version=1.0
    [18:16:51 INF] Sending HTTP request GET https://localhost:44380/api/cms-kit-public/pages/Error?api-version=1.0
    [18:16:51 INF] Received HTTP response headers after 71.9637ms - 403
    [18:16:51 INF] End processing HTTP request after 72.1478ms - 403
    [18:16:51 ERR] ---------- RemoteServiceErrorInfo ----------
    {
      "code": "Forbidden",
      "message": "Forbidden",
      "details": null,
      "data": null,
      "validationErrors": null
    }
    
    
  • User Avatar
    0
    niall created

    Hi,

    Is there a way to display only in the PublicWeb and hide in the AdminWeb?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Of course, Remove Volo.CmsKit.Pro.Web package from ProductService.Web and install the Volo.CmsKit.Pro.Admin.Web package.

  • User Avatar
    0
    niall created

    Hi,

    Read the post, throw exception.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Can you add the gateway config to PublicWebGateway?

    {
      "ServiceKey": "Product Service",
      "ServiceDns": "https://product.baaso.dev",
      "DownstreamPathTemplate": "/api/cms-kit/{everything}",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "localhost",
          "Port": 44360
        }
      ],
      "UpstreamPathTemplate": "/api/cms-kit/{everything}",
      "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ]
    },
    {
      "ServiceKey": "Product Service",
      "ServiceDns": "https://product.baaso.dev",
      "DownstreamPathTemplate": "/api/cms-kit-public/{everything}",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "localhost",
          "Port": 44360
        }
      ],
      "UpstreamPathTemplate": "/api/cms-kit-public/{everything}",
      "UpstreamHttpMethod": [ "Put", "Delete", "Get", "Post" ]
    }
    

    PS, you may need to add NPM package to web and public web projects and use the abp install-libs to restore package

  • User Avatar
    0
    niall created

    It was very difficult, and now everything is working properly :)

    Thank you very much, and I have a last question.

    The page component has content, script, stytle, so the script support abp api? If support, how to use it?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    The page component has content, script, stytle, so the script support abp api? If support, how to use it?

    Sorry, Can you explain it in detail? thanks.

  • User Avatar
    0
    niall created

    The page component has content, script, stytle, so the script support abp api? If support, how to use it?

    Sorry, Can you explain it in detail? thanks.

    I will try slowly in the future.

  • User Avatar
    0
    niall created

    I closed the features of CmsKit, system crashed. I must delete all databases and migrate again.

    Is there a way to reopen these features about CmsKit? Or not allowing users to close these?

    CmsKitService

    [18:16:51 INF] Route matched with {area = "cms-kit", action = "FindBySlug", controller = "PagesPublic"}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.CmsKit.Contents.PageDto] FindBySlugAsync(System.String) on controller Volo.CmsKit.Public.Pages.PagesPublicController (Volo.CmsKit.Public.HttpApi). 
    [18:16:51 WRN] ---------- RemoteServiceErrorInfo ---------- 
    { 
      "code": "Volo.Feature:010003", 
      "message": "Required features are not enabled. At least one of these features must be enabled: CmsKit.PageEnable", 
      "details": null, 
      "data": { 
        "FeatureNames": "CmsKit.PageEnable" 
      }, 
      "validationErrors": null 
    } 
     
    [18:16:51 WRN] Exception of type 'Volo.Abp.Authorization.AbpAuthorizationException' was thrown. 
    

    Web

    [18:16:50 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 
    [18:16:50 INF] Executing handler method XTC.BaaSo.Web.Pages.IndexModel.OnGet - ModelState is Valid 
    [18:16:50 INF] Executed handler method OnGet, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. 
    [18:16:50 ERR] An exception was thrown while deserializing the token. 
    Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted. 
     ---> System.Security.Cryptography.CryptographicException: The key {02049ad8-7d73-44b0-8795-e7b42d02cee1} was not found in the key ring. For more information go to http://aka.ms/dataprotectionwarning 
       at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status) 
       at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData) 
       at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) 
       --- End of inner exception stack trace --- 
       at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) 
       at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.GetCookieTokenDoesNotThrow(HttpContext httpContext) 
    [18:16:50 INF] Bundling __bundles/LeptonX.Global.9325FB768F9C0093DC4664395D730921.css (17 files) 
    [18:16:50 INF]   > Minified /libs/abp/core/abp.css (1331 bytes -> 868 bytes) 
    [18:16:50 INF]   > Minified /libs/@fortawesome/fontawesome-free/css/all.css (73577 bytes -> 53572 bytes) 
    [18:16:50 INF]   > Minified /libs/@fortawesome/fontawesome-free/css/v4-shims.css (41312 bytes -> 33344 bytes) 
    [18:16:50 INF]   > Minified /libs/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css (54850 bytes -> 43189 bytes) 
    [18:16:50 INF]   > Minified /libs/datatables.net-bs5/css/dataTables.bootstrap5.css (13491 bytes -> 11874 bytes) 
    [18:16:50 INF]   > Minified /libs/bootstrap-daterangepicker/daterangepicker.css (8069 bytes -> 6378 bytes) 
    [18:16:50 INF]   > Minified /libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-styles.css (266 bytes -> 214 bytes) 
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/libs/bootstrap-icons/font/bootstrap-icons.css (74827 bytes -> 57860 bytes) 
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/css/js-bundle.css (34690 bytes -> 30518 bytes) 
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/css/layout-bundle.css (251958 bytes -> 247161 bytes) 
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/css/abp-bundle.css (3870 bytes -> 3025 bytes) 
    [18:16:50 INF]   > Minified /Themes/LeptonX/Global/side-menu/css/font-bundle.css (117 bytes -> 116 bytes) 
    [18:16:50 INF]   > Minified /global-styles.css (348 bytes -> 279 bytes) 
    [18:16:50 INF] Bundled __bundles/LeptonX.Global.9325FB768F9C0093DC4664395D730921.css (542070 bytes) 
    [18:16:50 INF] Start processing HTTP request GET https://localhost:44380/api/abp/application-configuration?IncludeLocalizationResources=False&api-version=1.0 
    [18:16:50 INF] Sending HTTP request GET https://localhost:44380/api/abp/application-configuration?IncludeLocalizationResources=False&api-version=1.0 
    [18:16:50 INF] Received HTTP response headers after 64.8629ms - 200 
    [18:16:50 INF] End processing HTTP request after 65.0538ms - 200 
    [18:16:50 INF] Start processing HTTP request GET https://localhost:44380/api/abp/application-localization?CultureName=en&OnlyDynamics=True&api-version=1.0 
    [18:16:50 INF] Sending HTTP request GET https://localhost:44380/api/abp/application-localization?CultureName=en&OnlyDynamics=True&api-version=1.0 
    [18:16:50 INF] Received HTTP response headers after 42.4769ms - 200 
    [18:16:50 INF] End processing HTTP request after 42.6202ms - 200 
    [18:16:50 INF] Start processing HTTP request GET https://localhost:44380/api/cms-kit-public/menu-items?api-version=1.0 
    [18:16:50 INF] Sending HTTP request GET https://localhost:44380/api/cms-kit-public/menu-items?api-version=1.0 
    [18:16:51 INF] Received HTTP response headers after 897.3606ms - 403 
    [18:16:51 INF] End processing HTTP request after 897.6537ms - 403 
    [18:16:51 INF] Executed page /Index in 1549.3604ms 
    [18:16:51 INF] Executed endpoint '/Index' 
    [18:16:51 ERR] An unhandled exception has occurred while executing the request. 
    Volo.Abp.Http.Client.AbpRemoteCallException: Forbidden 
       at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.ThrowExceptionForResponseAsync(HttpResponseMessage response) 
       at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync(ClientProxyRequestContext requestContext) 
       at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](ClientProxyRequestContext requestContext) 
       at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments) 
       at Volo.CmsKit.Public.Menus.ClientProxies.MenuItemPublicClientProxy.GetListAsync() 
       at Volo.CmsKit.Public.Web.Menus.CmsKitPublicMenuContributor.ConfigureMainMenuAsync(MenuConfigurationContext context) 
       at Volo.CmsKit.Public.Web.Menus.CmsKitPublicMenuContributor.ConfigureMenuAsync(MenuConfigurationContext context) 
       at Volo.Abp.UI.Navigation.MenuManager.GetInternalAsync(String name) 
       at Volo.Abp.UI.Navigation.MenuManager.GetAsync(String[] menuNames) 
       at Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Navigation.MenuViewModelProvider.GetMenuViewModelAsync() 
       at Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Themes.LeptonX.Components.SideMenu.MainMenu.MainMenuViewComponent.InvokeAsync() 
       at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsyncCore(ObjectMethodExecutor executor, Object component, ViewComponentContext context) 
       at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context) 
       at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context) 
       at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeCoreAsync(ViewComponentDescriptor descriptor, Object arguments) 
       at Volo.Abp.AspNetCore.Mvc.UI.Widgets.AbpViewComponentHelper.InvokeAsync(Type componentType, Object arguments) 
       at V1baMV6YmQplw0X98PH.UPIMWT6TrLmYa5A0bLn.ExecuteAsync() 
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context) 
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts) 
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context) 
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.RenderPartialCoreAsync(String partialViewName, Object model, ViewDataDictionary viewData, TextWriter writer) 
       at Microsoft.AspNetCore.Mvc.ViewFeatures.HtmlHelper.PartialAsync(String partialViewName, Object model, ViewDataDictionary viewData) 
       at s9pw74fNUuN4Eq9OcZh.SMIS7FfDqF8eAAIYmQI.&lt;&gt;c__DisplayClass21_0.zesArhS6o8NoyemU221.MoveNext() 
    --- End of stack trace from previous location --- 
       at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync() 
       at s9pw74fNUuN4Eq9OcZh.SMIS7FfDqF8eAAIYmQI.ExecuteAsync() 
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context) 
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts) 
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter) 
       at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context) 
       at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode) 
       at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextResultFilterAsync&gt;g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeResultFilters&gt;g__Awaited|28_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextResourceFilter&gt;g__Awaited|25_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.&lt;InvokeFilterPipelineAsync&gt;g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeAsync&gt;g__Logged|17_1(ResourceInvoker invoker) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeAsync&gt;g__Logged|17_1(ResourceInvoker invoker) 
       at Microsoft.AspNetCore.Routing.EndpointMiddleware.&lt;Invoke&gt;g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) 
       at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) 
       at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.&lt;&gt;c__DisplayClass6_1.&lt;&lt;UseMiddlewareInterface&gt;b__1>d.MoveNext() 
    --- End of stack trace from previous location --- 
       at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.&lt;&gt;c__DisplayClass6_1.&lt;&lt;UseMiddlewareInterface&gt;b__1>d.MoveNext() 
    --- End of stack trace from previous location --- 
       at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) 
       at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.&lt;&gt;c__DisplayClass6_1.&lt;&lt;UseMiddlewareInterface&gt;b__1>d.MoveNext() 
    --- End of stack trace from previous location --- 
       at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.&lt;&gt;c__DisplayClass6_1.&lt;&lt;UseMiddlewareInterface&gt;b__1>d.MoveNext() 
    --- End of stack trace from previous location --- 
       at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.&lt;Invoke&gt;g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task) 
    [18:16:51 INF] Executing endpoint '/Public/CmsKit/Pages/Index' 
    [18:16:51 INF] Route matched with {page = "/Public/CmsKit/Pages/Index", action = "", controller = "", area = ""}. Executing page /Public/CmsKit/Pages/Index 
    [18:16:51 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 
    [18:16:51 INF] Executing handler method Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Pages.IndexModel.OnGetAsync - ModelState is Valid 
    [18:16:51 INF] Start processing HTTP request GET https://localhost:44380/api/cms-kit-public/pages/Error?api-version=1.0 
    [18:16:51 INF] Sending HTTP request GET https://localhost:44380/api/cms-kit-public/pages/Error?api-version=1.0 
    [18:16:51 INF] Received HTTP response headers after 71.9637ms - 403 
    [18:16:51 INF] End processing HTTP request after 72.1478ms - 403 
    [18:16:51 ERR] ---------- RemoteServiceErrorInfo ---------- 
    { 
      "code": "Forbidden", 
      "message": "Forbidden", 
      "details": null, 
      "data": null, 
      "validationErrors": null 
    } 
     
    

    How to resolve this issue?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    It looks like a problem. you can try:

    public class MyCmsKitPublicMenuContributor : IMenuContributor
    {
        public async Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name == CmsKitMenus.Public)
            {
                await ConfigureMainMenuAsync(context);
            }
        }
    
        private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
        {
            var featureCheck = context.ServiceProvider.GetRequiredService<IFeatureChecker>();
            if (GlobalFeatureManager.Instance.IsEnabled<MenuFeature>() && await featureCheck.IsEnabledAsync(CmsKitFeatures.MenuEnable))
            {
                var menuAppService = context.ServiceProvider.GetRequiredService<IMenuItemPublicAppService>();
    
                var menuItems = await menuAppService.GetListAsync();
    
                if (!menuItems.IsNullOrEmpty())
                {
                    foreach (var menuItemDto in menuItems.Where(x => x.ParentId == null && x.IsActive))
                    {
                        AddChildItems(menuItemDto, menuItems, context.Menu);
                    }
                }
            }
        }
    
        private void AddChildItems(MenuItemDto menuItem, List<MenuItemDto> source, IHasMenuItems parent = null)
        {
            var applicationMenuItem = CreateApplicationMenuItem(menuItem);
    
            foreach (var item in source.Where(x => x.ParentId == menuItem.Id && x.IsActive))
            {
                AddChildItems(item, source, applicationMenuItem);
            }
    
            parent?.Items.Add(applicationMenuItem);
        }
    
        private ApplicationMenuItem CreateApplicationMenuItem(MenuItemDto menuItem)
        {
            return new ApplicationMenuItem(
                menuItem.DisplayName,
                menuItem.DisplayName,
                menuItem.Url,
                menuItem.Icon,
                menuItem.Order,
                menuItem.Target,
                menuItem.ElementId,
                menuItem.CssClass
            );
        }
    }
    
    Configure<AbpNavigationOptions>(options =>
    {
        options.MenuContributors.RemoveAll(x => x.GetType() == typeof(CmsKitPublicMenuContributor));
        options.MenuContributors.Add(new MyCmsKitPublicMenuContributor());;
    });
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    We will fix it in the next patch version: https://github.com/abpframework/abp/issues/17866

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