Do you need more information about the project to try and find a solution?
I've added what you told me in the DbMigrator project but I still get the same error.
Do you have another idea?
Hello,
I'm trying to deploy my application on a docker server from Portainer.
I'm having a problem launching the DbMigrator project.
[07:57:50 INF] Started database migrations...
[07:57:50 INF] Migrating schema for host database...
[07:57:56 INF] Executing host database seed...
Unhandled exception. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Volo.Abp.Identity.IdentityDataSeedContributor -> Volo.Abp.Identity.IdentityDataSeeder -> Castle.Proxies.IdentityUserManagerProxy -> Volo.Abp.Identity.IdentityProUserStore -> Volo.Abp.Features.FeatureChecker -> λ:Volo.Abp.Features.IFeatureDefinitionManager -> Volo.Abp.Features.FeatureDefinitionManager -> Volo.Abp.FeatureManagement.DynamicFeatureDefinitionStore -> Volo.Abp.FeatureManagement.FeatureDefinitionSerializer -> Volo.Abp.Localization.LocalizableStringSerializer.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptions`1[Volo.Abp.Localization.AbpLocalizationOptions])' on type 'LocalizableStringSerializer'.
---> System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
cs is an invalid culture identifier.
at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
at Volo.Abp.Localization.LanguageInfo.ChangeCultureInternal(String cultureName, String uiCultureName, String displayName)
at Volo.Abp.Localization.LanguageInfo..ctor(String cultureName, String uiCultureName, String displayName, String flagIcon)
at Budget.BudgetDomainModule.<>c.<ConfigureServices>b__0_1(AbpLocalizationOptions options) in /src/src/Budget.Domain/BudgetDomainModule.cs:line 54
at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
at lambda_method335(Closure, Object[])
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
--- End of inner exception stack trace ---
at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass14_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext ctxt, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.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.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action`1 next)
at Autofac.Core.Resolving.Middleware.DelegateMiddleware.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.<>c__DisplayClass14_0.<BuildPipeline>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.<>c__DisplayClass14_0.<BuildPipeline>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 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.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
at Budget.Data.BudgetDbMigrationService.SeedDataAsync(Tenant tenant) in /src/src/Budget.Domain/Data/BudgetDbMigrationService.cs:line 104
at Budget.Data.BudgetDbMigrationService.MigrateAsync() in /src/src/Budget.Domain/Data/BudgetDbMigrationService.cs:line 54
at Budget.DbMigrator.DbMigratorHostedService.StartAsync(CancellationToken cancellationToken) in /src/src/Budget.DbMigrator/DbMigratorHostedService.cs:line 36
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 Budget.DbMigrator.Program.Main(String[] args) in /src/src/Budget.DbMigrator/Program.cs:line 28
at Budget.DbMigrator.Program.<Main>(String[] args)
I have seen several possible solutions to this problem:
set the invariantCultre Env variable in the dockerFile
I did it:
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
I have this issue only when i lauch the DbMigrator Projet from portainer. When I run the project locally, I don't get any errors Can you help me to sole this problem
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var env = context.GetEnvironment();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseAbpRequestLocalization();
app.UseStaticFiles();
app.UseAbpSecurityHeaders();
app.UseRouting();
app.UseCors();
app.UseAuthentication();
if (MultiTenancyConsts.IsEnabled)
{
app.UseMultiTenancy();
}
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Admin API");
var configuration = context.GetConfiguration();
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]);
});
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseUnitOfWork();
app.UseConfiguredEndpoints();
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
AsyncAuthorization = new[] { new AbpHangfireAuthorizationFilter(enableTenant: true, requiredPermissionName: "Admin.HangFire") }
});
}```
Hello, Our project structure is mentioned in this ticket : https://support.abp.io/QA/Questions/4663#answer-3a09d256-58d0-4c55-dc67-7e989f693fb3
We tried to add Hangfire in Admin part of the project (ConfigurateurClient.Admin.HttpApi.Host\AdminHttpApiHostModule.cs).
we called app.UseHangFireDashboard on the last line of OnApplicationInitialization method.
The Admin.HangFire pemrission is well defined in the application.contract layer
But when we want acces to https://localhost:44340/hangfire, we have this message.
Avez-vous des informations sur ce que nous aurions pu manquer pour générer ce type d'erreur ?
ABP Framework version: v7.0.0
UI type: Angular and Blazor (not relevant here)
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): no
Hello, Our project is an application that is composed of two back. (see screenshot)
we want that when launching a database migration, 3 roles are created and that the permissions (already defined) are set for the created roles. Permissions are defined in the folders:
ConfigurateurClient.Admin.Application.Contracts/Permissions and
ConfigurateurClient.Application.Contracts/Permissions
We have created a DataSeeding in the application layer
namespace ConfigurateurClient.Admin.DataSeeding
{
public class DataSeedingRoleAppService : AdminAppService, IDataSeedingRoleAppService
{
private readonly IRepository _userRepository;
private readonly IRepository _roleRepository;
private readonly IIdentityRoleAppService _identityAppService;
private readonly IPermissionAppService _permissionAppService;
private readonly IPermissionManager _permissionManager;
public DataSeedingRoleAppService(IRepository userRepository, IRepository roleRepository, IIdentityRoleAppService identityAppService, IPermissionAppService permissionAppService, IPermissionManager permissionManager)
{
_userRepository = userRepository;
_roleRepository = roleRepository;
_identityAppService = identityAppService;
_permissionAppService = permissionAppService;
_permissionManager = permissionManager;
}
public async Task PostCreateDefaultRoles()
{
var roles = await _roleRepository.GetListAsync();
await CreateRoleAdmin(roles);
await CreateRoleClient(roles);
await CreateRoleManuloc(roles);
}
private async Task CreateRoleAdmin(List listRoles)
{
var isRoleAdminExist = listRoles.Where(r => r.Name == "admin").ToList();
IdentityRoleDto roleAdmin = new();
if(isRoleAdminExist.Count == 0)
{
roleAdmin = await _identityAppService.CreateAsync(new IdentityRoleCreateDto
{
Name = "admin",
IsDefault = false,
IsPublic = true
});
}
}
private async Task CreateRoleClient(List listRoles)
{
var isRoleClientExist = listRoles.Where(r => r.Name == "client").ToList();
if (isRoleClientExist.Count == 0)
{
await _identityAppService.CreateAsync(new IdentityRoleCreateDto
{
Name = "client",
IsDefault = false,
IsPublic = true
});
}
}
private async Task CreateRoleManuloc(List listRoles)
{
var isRoleManuloxExist = listRoles.Where(r => r.Name == "manuloc").ToList();
IdentityRoleDto roleManuloc = new();
if (isRoleManuloxExist.Count == 0)
{
roleManuloc = await _identityAppService.CreateAsync(new IdentityRoleCreateDto
{
Name = "manuloc",
IsDefault = false,
IsPublic = true
});
}
await SetPermissionToRoleManuloc(roleManuloc);
}
private async Task SetPermissionToRoleManuloc(IdentityRoleDto roleManuloc)
{
UpdatePermissionsDto Permissions = new();
List permission = new List();
permission.Add(new UpdatePermissionDto { Name = "Admin.Client",IsGranted = true});
permission.Add(new UpdatePermissionDto { Name = "Admin.Configuration", IsGranted = true });
permission.Add(new UpdatePermissionDto { Name = "Admin.Contact", IsGranted = true });
permission.Add(new UpdatePermissionDto { Name = "Admin.Option", IsGranted = true });
permission.Add(new UpdatePermissionDto { Name = "Admin.GroupeOption", IsGranted = true });
permission.Add(new UpdatePermissionDto { Name = "Admin.Modeles", IsGranted = true });
permission.Add(new UpdatePermissionDto { Name = "Admin.Ulisateur", IsGranted = true });
permission.Add(new UpdatePermissionDto { Name = "Admin.Caracteristique", IsGranted = true });
permission.Add(new UpdatePermissionDto { Name = "Admin.TauxLocation", IsGranted = true });
permission.Add(new UpdatePermissionDto { Name = "Admin.Ulisateur", IsGranted = true });
Permissions.Permissions = permission.ToArray();
await _permissionAppService.UpdateAsync("R", "manuloc", Permissions);
}
}
}
But, we want that when launching a database migration.
We tried to use the IDataSeedContributor, but some Repositories are not accessible.
public class DataSeedingRoleAppService : IDataSeedContributor, ITransientDependency
{
private readonly IIdentityRoleAppService _identityAppService;
private readonly IPermissionAppService _permissionAppService;
public DataSeedingRoleAppService(IIdentityRoleAppService identityAppService, IPermissionAppService permissionAppService)
{
_identityAppService = identityAppService;
_permissionAppService = permissionAppService;
}
}
then I launched a database migration and got this error :
Exception message and stack trace: [16:00:51 INF] Executing host database seed... Unhandled exception. Autofac.Core.DependencyResolutionException: An exception was thrown while activating ConfigurateurClient.Admin.DataSeeding.DataSeedingRoleAppService. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'ConfigurateurClient.Admin.DataSeeding.DataSeedingRoleAppService' can be invoked with the available services and parameters: Cannot resolve parameter 'Volo.Abp.Identity.IIdentityRoleAppService identityAppService' of constructor 'Void .ctor(Volo.Abp.Identity.IIdentityRoleAppService, Volo.Abp.PermissionManagement.IPermissionAppService)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass12_0.b__0(ResolveRequestContext ctxt, Action1 next) at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.
(String[] args)
ABP Framework version: v7.0.0 UI type: Angular and Blazor (not relevant here)
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): no