abpframework/abp · critical · AbpInitializationException
An error occurred during ConfigureServicesAsync phase of the
Error message
An error occurred during ConfigureServicesAsync phase of the module {module.Type.AssemblyQualifiedName}. See the inner exception for details. What it means
During async initialization ABP iterates all modules and awaits ConfigureServicesAsync(context), the main service-registration phase where most DI setup happens. If any module throws, ABP wraps it in AbpInitializationException naming the module's AssemblyQualifiedName with the original as InnerException. This is the most common phase to fail because it is where the bulk of ConfigureServices logic runs.
Source
Thrown at framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationBase.cs:272
{
foreach (var assembly in module.AllAssemblies)
{
if (!assemblies.Contains(assembly))
{
Services.AddAssembly(assembly);
assemblies.Add(assembly);
}
}
}
}
try
{
await module.Instance.ConfigureServicesAsync(context);
}
catch (Exception ex)
{
throw new AbpInitializationException($"An error occurred during {nameof(IAbpModule.ConfigureServicesAsync)} phase of the module {module.Type.AssemblyQualifiedName}. See the inner exception for details.", ex);
}
}
//PostConfigureServices
foreach (var module in Modules.Where(m => m.Instance is IPostConfigureServices))
{
try
{
await ((IPostConfigureServices)module.Instance).PostConfigureServicesAsync(context);
}
catch (Exception ex)
{
throw new AbpInitializationException($"An error occurred during {nameof(IPostConfigureServices.PostConfigureServicesAsync)} phase of the module {module.Type.AssemblyQualifiedName}. See the inner exception for details.", ex);
}
}
foreach (var module in Modules)
{View on GitHub (pinned to 7ed43b1931)
Solutions
- Read ex.InnerException first - it holds the actual exception and stack trace.
- Open the ConfigureServicesAsync override of the module named in the message and trace the failing registration.
- Check appsettings.json (ConnectionStrings, the module's options section) for missing or malformed values.
- Temporarily enable Microsoft.Extensions.Logging debug output during startup to see which registration failed.
Defensive patterns
Strategy: try-catch
Try / catch
try
{
await application.ConfigureServicesAsync();
}
catch (AbpInitializationException ex) when (ex.Message.Contains("ConfigureServicesAsync"))
{
startupLogger.LogError(ex.InnerException, "Configure failed in {Module}", ex.Message);
throw;
} Prevention
- Always drill into ex.InnerException when diagnosing ConfigureServices failures.
- Keep ConfigureServices overrides small and delegate to testable helper methods.
- Validate connection strings and option sections before they reach ConfigureServices (e.g. in Program.cs).
When it happens
Trigger: A module's ConfigureServicesAsync override throws: a conflicting service registration, a missing dependent service, an exception while configuring options, or a database/migration helper invoked too early.
Common situations: EF Core DbContext misconfiguration; a module calling AddDbContext with a bad connection string; circular dependency between module ConfigureServices; ABP version upgrade introducing a breaking registration change; a third-party module failing to find an expected section.
Related errors
- An error occurred during PreConfigureServicesAsync phase of
- An error occurred during PostConfigureServicesAsync phase of
- An error occurred during ConfigureServices phase of the modu
- Services have already been configured! If you call Configure
- An error occurred during PreConfigureServices phase of the m
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/3c096cc42e9126a3.
Report an issue: GitHub.