Open Closed

Tenant Domain Resolution The requested service 'Volo.Abp.TenantManagement.EntityFrameworkCore.TenantManagementDbContext' has not been registered. #7868


User avatar
0
TonyLewis created

Check the samples to s ee the basic tasks: https://abp.io/docs/latest/samples 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: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • ABP Framework version: v8.2.2
  • UI Type: MVC
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC): yes
  • Exception message and full stack trace: The requested service 'Volo.Abp.TenantManagement.EntityFrameworkCore.TenantManagementDbContext' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency. See https://autofac.rtfd.io/help/service-not-registered for more info.
  • Steps to reproduce the issue:

This is an implementation of the Domain Tenant Resolution. We had this running with a community edition of the library. We implemented the commercial package and made the same modifications, but now it throws this error.

public class CustomTenantRepository : EfCoreRepository<TenantManagementDbContext, Tenant, Guid>, ICustomTenantRepository
{
    public CustomTenantRepository(IDbContextProvider<TenantManagementDbContext> dbContextProvider) : base(dbContextProvider)
    {
    }

    public async Task<Tenant> GetTenantByDomain(string host, CancellationToken cancellationToken = default)
    {
        var context = await GetDbContextAsync();
        var tenant = context.Tenants.Where(u => EF.Property<string>(u, "Domain") == host);
        return await tenant.FirstOrDefaultAsync(cancellationToken: cancellationToken);
    }
}

Is the DbContext different in the pro module?

I don't know what to check next.

Thanks, Tony Lewis

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We use the SaasDbContext(Saas module) in the commercial version.

    The TenantManagementDbContext is free&opensource module.

    you should use the Saas module

    https://abp.io/modules/Volo.Saas https://abp.io/docs/commercial/latest/modules/saas

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.